Commit a2dc2fe228fa03bead79287b943c39a62e80df4d
base测试3
Showing
22 changed files
with
159 additions
and
77 deletions
app/strike/src/main/java/com/cnlive/strike/MyActivity.java
app/strike/src/main/java/com/cnlive/strike/MyFragment.java
| 1 | 1 | package com.cnlive.strike; |
| 2 | 2 | |
| 3 | + | |
| 3 | 4 | import android.os.Bundle; |
| 4 | -import android.view.LayoutInflater; | |
| 5 | 5 | import android.view.View; |
| 6 | -import android.view.ViewGroup; | |
| 7 | 6 | import android.widget.TextView; |
| 8 | 7 | |
| 9 | - | |
| 10 | 8 | import com.cnlive.libs.base.frame.fragment.BaseFragment; |
| 11 | 9 | |
| 12 | 10 | import androidx.annotation.Nullable; |
| 13 | 11 | |
| 14 | 12 | |
| 15 | -public class MyFragment extends BaseFragment <MyFragmentView,MyPresenter> implements MyFragmentView{ | |
| 16 | - | |
| 17 | - public TextView tx; | |
| 18 | - | |
| 13 | +public class MyFragment extends BaseFragment <MyFragmentView,MyPresenter>{ | |
| 19 | 14 | |
| 20 | - @Override | |
| 21 | - public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | |
| 22 | - super.onViewCreated(view, savedInstanceState); | |
| 23 | - tx = view.findViewById(R.id.my_tx); | |
| 24 | - if(getPresenter() != null) getPresenter().setData("hah"); | |
| 25 | - } | |
| 26 | - | |
| 27 | - @Override | |
| 28 | - public void setData(String msg) { | |
| 29 | - tx.setText(msg); | |
| 30 | - } | |
| 31 | 15 | |
| 16 | + public TextView tx; | |
| 32 | 17 | @Override |
| 33 | - public MyPresenter createPresenter() { | |
| 34 | - return new MyPresenter(); | |
| 18 | + protected int getLayoutId() { | |
| 19 | + return R.layout.activity_main1; | |
| 35 | 20 | } |
| 36 | 21 | |
| 37 | 22 | @Override |
| 38 | - protected int getLayoutId() { | |
| 39 | - return R.layout.fragment_my; | |
| 23 | + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | |
| 24 | + super.onViewCreated(view, savedInstanceState); | |
| 25 | + tx = view.findViewById(R.id.tv1); | |
| 26 | + getPresenter().setData("hha"); | |
| 27 | +// getMvpView().setData("sasa"); | |
| 40 | 28 | } |
| 41 | 29 | } | ... | ... |
app/strike/src/main/java/com/cnlive/strike/MyFragmentView.java
| ... | ... | @@ -2,6 +2,14 @@ package com.cnlive.strike; |
| 2 | 2 | |
| 3 | 3 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| 4 | 4 | |
| 5 | -public interface MyFragmentView extends MvpView { | |
| 6 | - void setData(String msg); | |
| 5 | +public class MyFragmentView implements MvpView { | |
| 6 | + MyFragment fragment; | |
| 7 | + | |
| 8 | + public MyFragmentView(MyFragment fragment) { | |
| 9 | + this.fragment = fragment; | |
| 10 | + } | |
| 11 | + | |
| 12 | + public void setData(String msg){ | |
| 13 | + fragment.tx.setText(msg); | |
| 14 | + } | |
| 7 | 15 | } | ... | ... |
core/base/src/main/java/com/cnlive/libs/base/frame/fragment/BaseFragment.java
| ... | ... | @@ -5,9 +5,12 @@ import android.view.LayoutInflater; |
| 5 | 5 | import android.view.View; |
| 6 | 6 | import android.view.ViewGroup; |
| 7 | 7 | |
| 8 | +import androidx.annotation.NonNull; | |
| 8 | 9 | import androidx.annotation.Nullable; |
| 9 | 10 | |
| 10 | 11 | import com.cnlive.libs.base.frame.presenter.BasePresenter; |
| 12 | +import com.cnlive.libs.base.frame.view.BaseView; | |
| 13 | +import com.cnlive.libs.base.util.ReflectUtil; | |
| 11 | 14 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; |
| 12 | 15 | import com.hannesdorfmann.mosby3.mvp.MvpPresenter; |
| 13 | 16 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| ... | ... | @@ -21,6 +24,7 @@ import com.hannesdorfmann.mosby3.mvp.MvpView; |
| 21 | 24 | public abstract class BaseFragment<V extends MvpView, P extends MvpBasePresenter<V>> extends com.hannesdorfmann.mosby3.mvp.MvpFragment<V, P> { |
| 22 | 25 | |
| 23 | 26 | public View view; |
| 27 | + public V views; | |
| 24 | 28 | |
| 25 | 29 | @Nullable |
| 26 | 30 | @Override |
| ... | ... | @@ -34,11 +38,25 @@ public abstract class BaseFragment<V extends MvpView, P extends MvpBasePresenter |
| 34 | 38 | getPresenter(); |
| 35 | 39 | } |
| 36 | 40 | |
| 37 | -// @Override | |
| 38 | -// public P createPresenter() { | |
| 39 | -// return (P) new BasePresenter(); | |
| 40 | -// } | |
| 41 | + @NonNull | |
| 42 | + public V createView() { | |
| 43 | + return ReflectUtil.instanceView(0, this.getClass(), this, BaseView.class); | |
| 44 | + } | |
| 41 | 45 | |
| 42 | - protected abstract int getLayoutId(); | |
| 46 | + @Override | |
| 47 | + public P createPresenter() { | |
| 48 | + return ReflectUtil.instancePresenter(1, this.getClass(), BasePresenter.class); | |
| 49 | + } | |
| 43 | 50 | |
| 51 | + @NonNull | |
| 52 | + @Override | |
| 53 | + public V getMvpView() { | |
| 54 | + if (null == views) { | |
| 55 | + return createView(); | |
| 56 | + } else { | |
| 57 | + return views; | |
| 58 | + } | |
| 59 | + } | |
| 60 | + | |
| 61 | + protected abstract int getLayoutId(); | |
| 44 | 62 | } |
| 45 | 63 | \ No newline at end of file | ... | ... |
core/base/src/main/java/com/cnlive/libs/base/frame/view/BaseView.java
core/base/src/main/java/com/cnlive/libs/base/media/picker/ImageCaptureManager.java
core/base/src/main/java/com/cnlive/libs/base/media/picker/ui/camera/DiyCameraActivity.java
| ... | ... | @@ -312,7 +312,7 @@ public class DiyCameraActivity extends AppCompatActivity implements Recyclerview |
| 312 | 312 | Media media = new Media(file.getPath(), file.getName(), enddutain, 3, file.length(), 0, "", enddutain); |
| 313 | 313 | medias.add(media); |
| 314 | 314 | oldlist.add(media); |
| 315 | - CircleData.ReleaseVideoTypeListBean releaseVideoTypeListBean = releaseVideoTypeListBeans.get((Integer) v.getTag()); | |
| 315 | + CircleData.ReleaseVideoTypeListBean releaseVideoTypeListBean = releaseVideoTypeListBeans.get((Integer) view.getTag()); | |
| 316 | 316 | intent.putParcelableArrayListExtra(PickerConfig.EXTRA_RESULT, oldlist); |
| 317 | 317 | intent.putExtra("isCircleVideo", "cancircle"); |
| 318 | 318 | EventBus.getDefault().postSticky(new CircleChoose(releaseVideoTypeListBean)); | ... | ... |
core/base/src/main/java/com/cnlive/libs/base/media/picker/view/HackyViewPager.java
| ... | ... | @@ -9,11 +9,11 @@ import android.view.MotionEvent; |
| 9 | 9 | /** |
| 10 | 10 | * Hacky fix for Issue #4 and |
| 11 | 11 | * http://code.google.com/p/android/issues/detail?id=18990 |
| 12 | - * <p/> | |
| 12 | + * <presenter/> | |
| 13 | 13 | * ScaleGestureDetector seems to mess up the touch events, which means that |
| 14 | 14 | * ViewGroups which make use of onInterceptTouchEvent throw a lot of |
| 15 | 15 | * IllegalArgumentException: pointerIndex out of range. |
| 16 | - * <p/> | |
| 16 | + * <presenter/> | |
| 17 | 17 | * There's not much I can do in my code for now, but we can mask the result by |
| 18 | 18 | * just catching the problem and ignoring it. |
| 19 | 19 | * | ... | ... |
core/base/src/main/java/com/cnlive/libs/base/media/picker/view/crop/CropView.java
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | * Copyright 2016 oginotihiro |
| 3 | - * <p/> | |
| 3 | + * <presenter/> | |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| 6 | 6 | * You may obtain a copy of the License at |
| 7 | - * <p/> | |
| 7 | + * <presenter/> | |
| 8 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | - * <p/> | |
| 9 | + * <presenter/> | |
| 10 | 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ... | ... |
core/base/src/main/java/com/cnlive/libs/base/ui/widget/arch/BottomMenuDialog.java
core/base/src/main/java/com/cnlive/libs/base/ui/widget/arch/BottomSheet.java
| ... | ... | @@ -33,12 +33,12 @@ import java.util.List; |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * QMUIBottomSheet 在 {@link Dialog} 的基础上重新定制了 {@link #show()} 和 {@link #hide()} 时的动画效果, 使 {@link Dialog} 在界面底部升起和降下。 |
| 36 | - * <p> | |
| 36 | + * <presenter> | |
| 37 | 37 | * 提供了以下两种面板样式: |
| 38 | 38 | * <ul> |
| 39 | 39 | * <li>列表样式, 使用 {@link BottomSheet.BottomListSheetBuilder} 生成。</li> |
| 40 | 40 | * </ul> |
| 41 | - * </p> | |
| 41 | + * </presenter> | |
| 42 | 42 | */ |
| 43 | 43 | public class BottomSheet extends Dialog { |
| 44 | 44 | private static final String TAG = "QMUIBottomSheet"; | ... | ... |
core/base/src/main/java/com/cnlive/libs/base/ui/widget/arch/LetterBarView.java
| ... | ... | @@ -46,13 +46,13 @@ import com.cnlive.strike.base.R; |
| 46 | 46 | /** |
| 47 | 47 | * 字母导航条 |
| 48 | 48 | * |
| 49 | - * <p> | |
| 49 | + * <presenter> | |
| 50 | 50 | * 可用于需要按照字母排序的应用中. <br> |
| 51 | 51 | * 若排序的 item 首字为中文时,需要将每个 item 的首个汉字转化为拼音然后进行排序.<br>将汉字转换为拼音可用 pinyin4j.jar 来转换 |
| 52 | - * </p> | |
| 53 | - * <p> | |
| 52 | + * </presenter> | |
| 53 | + * <presenter> | |
| 54 | 54 | * 当点击导航条的字母时,会触发监听事件,若要监听,则可以使用 {@link #setOnLetterSelectListener(OnLetterSelectListener)} 来设置 |
| 55 | - * </p> | |
| 55 | + * </presenter> | |
| 56 | 56 | * |
| 57 | 57 | * @attr ref com.lwz.letterbarview.lib.R.styleable#LetterBar_lbLetterBarBackground |
| 58 | 58 | * @attr ref com.lwz.letterbarview.lib.R.styleable#LetterBar_lbLetterBarTextColor |
| ... | ... | @@ -225,7 +225,7 @@ public class LetterBarView extends View { |
| 225 | 225 | |
| 226 | 226 | /** |
| 227 | 227 | * 计算字母导航条的参数 |
| 228 | - * <p> 根据字母的高度来计算 导航条的宽度 和 其在 X 轴的位置 | |
| 228 | + * <presenter> 根据字母的高度来计算 导航条的宽度 和 其在 X 轴的位置 | |
| 229 | 229 | */ |
| 230 | 230 | private void calculateLetterBarParams() { |
| 231 | 231 | calculateLetterSpaceHeight(); | ... | ... |
core/base/src/main/java/com/cnlive/libs/base/util/BrandUtils.java
core/base/src/main/java/com/cnlive/libs/base/util/FileUtils.java
| ... | ... | @@ -31,9 +31,9 @@ import static android.os.Environment.MEDIA_MOUNTED; |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * 作者: 吴奎庆 |
| 34 | - * <p> | |
| 34 | + * <presenter> | |
| 35 | 35 | * 时间: 2018/9/11 |
| 36 | - * <p> | |
| 36 | + * <presenter> | |
| 37 | 37 | * 简介: |
| 38 | 38 | */ |
| 39 | 39 | |
| ... | ... | @@ -669,7 +669,7 @@ public class FileUtils { |
| 669 | 669 | |
| 670 | 670 | /** |
| 671 | 671 | * Return the files in directory. |
| 672 | - * <p>Doesn't traverse subdirectories</p> | |
| 672 | + * <presenter>Doesn't traverse subdirectories</presenter> | |
| 673 | 673 | * |
| 674 | 674 | * @param dirPath The path of directory. |
| 675 | 675 | * @return the files in directory |
| ... | ... | @@ -680,7 +680,7 @@ public class FileUtils { |
| 680 | 680 | |
| 681 | 681 | /** |
| 682 | 682 | * Return the files in directory. |
| 683 | - * <p>Doesn't traverse subdirectories</p> | |
| 683 | + * <presenter>Doesn't traverse subdirectories</presenter> | |
| 684 | 684 | * |
| 685 | 685 | * @param dir The directory. |
| 686 | 686 | * @return the files in directory |
| ... | ... | @@ -718,7 +718,7 @@ public class FileUtils { |
| 718 | 718 | |
| 719 | 719 | /** |
| 720 | 720 | * Return the files that satisfy the filter in directory. |
| 721 | - * <p>Doesn't traverse subdirectories</p> | |
| 721 | + * <presenter>Doesn't traverse subdirectories</presenter> | |
| 722 | 722 | * |
| 723 | 723 | * @param dirPath The path of directory. |
| 724 | 724 | * @param filter The filter. |
| ... | ... | @@ -731,7 +731,7 @@ public class FileUtils { |
| 731 | 731 | |
| 732 | 732 | /** |
| 733 | 733 | * Return the files that satisfy the filter in directory. |
| 734 | - * <p>Doesn't traverse subdirectories</p> | |
| 734 | + * <presenter>Doesn't traverse subdirectories</presenter> | |
| 735 | 735 | * |
| 736 | 736 | * @param dir The directory. |
| 737 | 737 | * @param filter The filter. | ... | ... |
core/base/src/main/java/com/cnlive/libs/base/util/GlideRoundedCornersTransform.java
core/base/src/main/java/com/cnlive/libs/base/util/ReflectUtil.java
| 1 | 1 | package com.cnlive.libs.base.util; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | +import android.util.Log; | |
| 5 | + | |
| 4 | 6 | import java.lang.reflect.Constructor; |
| 7 | +import java.lang.reflect.InvocationTargetException; | |
| 5 | 8 | import java.lang.reflect.Method; |
| 6 | 9 | import java.lang.reflect.ParameterizedType; |
| 7 | 10 | |
| ... | ... | @@ -51,6 +54,7 @@ public class ReflectUtil { |
| 51 | 54 | return result; |
| 52 | 55 | } |
| 53 | 56 | |
| 57 | + | |
| 54 | 58 | public static <R> R instance(Class type) { |
| 55 | 59 | R result = null; |
| 56 | 60 | try { |
| ... | ... | @@ -71,4 +75,68 @@ public class ReflectUtil { |
| 71 | 75 | } |
| 72 | 76 | return result; |
| 73 | 77 | } |
| 78 | + | |
| 79 | + | |
| 80 | + /** | |
| 81 | + * 创建view的实例 | |
| 82 | + * | |
| 83 | + * @param position | |
| 84 | + * @param type | |
| 85 | + * @param data | |
| 86 | + * @param baseView | |
| 87 | + * @param <R> | |
| 88 | + * @return | |
| 89 | + */ | |
| 90 | + public static <R> R instanceView(int position, Class type, Object data, Class baseView) { | |
| 91 | + R result = null; | |
| 92 | + Class<R> clazz = null; | |
| 93 | + try { | |
| 94 | + ParameterizedType pt = (ParameterizedType) type.getGenericSuperclass(); | |
| 95 | + clazz = (Class<R>) pt.getActualTypeArguments()[position]; | |
| 96 | + } catch (Exception e) { | |
| 97 | + //直接使用基类 | |
| 98 | + clazz=baseView; | |
| 99 | + } | |
| 100 | + Constructor constructor = null; | |
| 101 | + try { | |
| 102 | + constructor = clazz.getConstructor(new Class[]{data.getClass()}); | |
| 103 | + result = (R) constructor.newInstance(data); | |
| 104 | + } catch (NoSuchMethodException e) { | |
| 105 | + e.printStackTrace(); | |
| 106 | + //没有找到含有参数的构造函数 | |
| 107 | + try { | |
| 108 | + result = clazz.newInstance(); | |
| 109 | + } catch (IllegalAccessException ex) { | |
| 110 | + ex.printStackTrace(); | |
| 111 | + } catch (InstantiationException ex) { | |
| 112 | + ex.printStackTrace(); | |
| 113 | + } | |
| 114 | + } catch (IllegalAccessException e) { | |
| 115 | + e.printStackTrace(); | |
| 116 | + } catch (InstantiationException e) { | |
| 117 | + e.printStackTrace(); | |
| 118 | + } catch (InvocationTargetException e) { | |
| 119 | + e.printStackTrace(); | |
| 120 | + } | |
| 121 | + return result; | |
| 122 | + } | |
| 123 | + | |
| 124 | + public static <R> R instancePresenter(int position, Class type, Class basePresenter) { | |
| 125 | + R result = null; | |
| 126 | + try { | |
| 127 | + ParameterizedType pt = (ParameterizedType) type.getGenericSuperclass(); | |
| 128 | + Class<R> clazz = (Class<R>) pt.getActualTypeArguments()[position]; | |
| 129 | + result = clazz.newInstance(); | |
| 130 | + } catch (Exception ignored) { | |
| 131 | + Class<R> clazz = basePresenter; | |
| 132 | + try { | |
| 133 | + result = clazz.newInstance(); | |
| 134 | + } catch (IllegalAccessException e) { | |
| 135 | + e.printStackTrace(); | |
| 136 | + } catch (InstantiationException e) { | |
| 137 | + e.printStackTrace(); | |
| 138 | + } | |
| 139 | + } | |
| 140 | + return result; | |
| 141 | + } | |
| 74 | 142 | } | ... | ... |
core/base/src/main/java/com/cnlive/libs/base/util/StatusBarUtil2.java
| ... | ... | @@ -25,7 +25,7 @@ import java.lang.reflect.Method; |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * Created by Jaeger on 16/2/14. |
| 28 | - * <p> | |
| 28 | + * <presenter> | |
| 29 | 29 | * Email: chjie.jaeger@gmail.com |
| 30 | 30 | * GitHub: https://github.com/laobie |
| 31 | 31 | */ |
| ... | ... | @@ -163,7 +163,7 @@ public class StatusBarUtil2 { |
| 163 | 163 | |
| 164 | 164 | /** |
| 165 | 165 | * 使状态栏半透明 |
| 166 | - * <p> | |
| 166 | + * <presenter> | |
| 167 | 167 | * 适用于图片作为背景的界面,此时需要图片填充到状态栏 |
| 168 | 168 | * |
| 169 | 169 | * @param activity 需要设置的activity |
| ... | ... | @@ -174,7 +174,7 @@ public class StatusBarUtil2 { |
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | 176 | * 使状态栏半透明 |
| 177 | - * <p> | |
| 177 | + * <presenter> | |
| 178 | 178 | * 适用于图片作为背景的界面,此时需要图片填充到状态栏 |
| 179 | 179 | * |
| 180 | 180 | * @param activity 需要设置的activity |
| ... | ... | @@ -190,7 +190,7 @@ public class StatusBarUtil2 { |
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | 192 | * 针对根布局是 CoordinatorLayout, 使状态栏半透明 |
| 193 | - * <p> | |
| 193 | + * <presenter> | |
| 194 | 194 | * 适用于图片作为背景的界面,此时需要图片填充到状态栏 |
| 195 | 195 | * |
| 196 | 196 | * @param activity 需要设置的activity |
| ... | ... | @@ -219,7 +219,7 @@ public class StatusBarUtil2 { |
| 219 | 219 | |
| 220 | 220 | /** |
| 221 | 221 | * 使状态栏透明(5.0以上半透明效果,不建议使用) |
| 222 | - * <p> | |
| 222 | + * <presenter> | |
| 223 | 223 | * 适用于图片作为背景的界面,此时需要图片填充到状态栏 |
| 224 | 224 | * |
| 225 | 225 | * @param activity 需要设置的activity | ... | ... |
core/base/src/main/java/com/cnlive/libs/base/util/WebPreviewShowImg.java
core/base/src/main/java/com/cnlive/libs/base/util/WebViewUtil.java
| ... | ... | @@ -22,7 +22,7 @@ public class WebViewUtil { |
| 22 | 22 | private static Activity context; |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | - * 将<p>标签转为html同时有回调 | |
| 25 | + * 将<presenter>标签转为html同时有回调 | |
| 26 | 26 | * |
| 27 | 27 | * @param pData |
| 28 | 28 | * @param webView |
| ... | ... | @@ -31,7 +31,7 @@ public class WebViewUtil { |
| 31 | 31 | public static void setPtoHtmlData(String pData, WebView webView, WebEleClickListener webEleClickListener) { |
| 32 | 32 | if (null != webView) { |
| 33 | 33 | webEleListener = webEleClickListener; |
| 34 | - String html = "<html><head><meta charset=\"UTF-8\"><style type=\"text/css\">html,body{padding:0px;margin:0px;font-size:40px} img{background-size:contain|cover;width:100%;height: auto;} p{margin:0px;font-size:40px}</style></head><body>" + pData + "</body></html>"; | |
| 34 | + String html = "<html><head><meta charset=\"UTF-8\"><style type=\"text/css\">html,body{padding:0px;margin:0px;font-size:40px} img{background-size:contain|cover;width:100%;height: auto;} presenter{margin:0px;font-size:40px}</style></head><body>" + pData + "</body></html>"; | |
| 35 | 35 | // 设置支持javascript脚本 |
| 36 | 36 | webView.getSettings().setJavaScriptEnabled(true); |
| 37 | 37 | webView.addJavascriptInterface(new JsObject(), "injectedObject"); |
| ... | ... | @@ -59,7 +59,7 @@ public class WebViewUtil { |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | - * 将<p>标签转为html没有回调,直接跳转 | |
| 62 | + * 将<presenter>标签转为html没有回调,直接跳转 | |
| 63 | 63 | * |
| 64 | 64 | * @param activity |
| 65 | 65 | * @param pData |
| ... | ... | @@ -68,7 +68,7 @@ public class WebViewUtil { |
| 68 | 68 | public static void setPtoHtmlData(Activity activity, String pData, WebView webView) { |
| 69 | 69 | if (null != webView) { |
| 70 | 70 | context = activity; |
| 71 | - String html = "<html><head><meta charset=\"UTF-8\"><style type=\"text/css\">html,body{padding:0px;margin:0px;font-size:40px} img{background-size:contain|cover;width:100%;height: auto;} p{margin:0px;font-size:40px}</style></head><body>" + pData + "</body></html>"; | |
| 71 | + String html = "<html><head><meta charset=\"UTF-8\"><style type=\"text/css\">html,body{padding:0px;margin:0px;font-size:40px} img{background-size:contain|cover;width:100%;height: auto;} presenter{margin:0px;font-size:40px}</style></head><body>" + pData + "</body></html>"; | |
| 72 | 72 | // 设置支持javascript脚本 |
| 73 | 73 | webView.getSettings().setJavaScriptEnabled(true); |
| 74 | 74 | webView.addJavascriptInterface(new JsObject(), "injectedObject"); |
| ... | ... | @@ -96,7 +96,7 @@ public class WebViewUtil { |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | - * 将<p>标签转为html没有回调,直接跳转,可指定文字大小 | |
| 99 | + * 将<presenter>标签转为html没有回调,直接跳转,可指定文字大小 | |
| 100 | 100 | * |
| 101 | 101 | * @param activity |
| 102 | 102 | * @param pData |
| ... | ... | @@ -107,7 +107,7 @@ public class WebViewUtil { |
| 107 | 107 | if (null != webView) { |
| 108 | 108 | context = activity; |
| 109 | 109 | |
| 110 | - String html = "<html><head><meta charset=\"UTF-8\"><style type=\"text/css\">html,body{padding:0px;margin:0px;font-size:" + fontSize + "px} img{background-size:contain|cover;width:100%;height: auto;} p{margin:0px;font-size:" + fontSize + "px}</style></head><body>" + pData + "</body></html>"; | |
| 110 | + String html = "<html><head><meta charset=\"UTF-8\"><style type=\"text/css\">html,body{padding:0px;margin:0px;font-size:" + fontSize + "px} img{background-size:contain|cover;width:100%;height: auto;} presenter{margin:0px;font-size:" + fontSize + "px}</style></head><body>" + pData + "</body></html>"; | |
| 111 | 111 | // 设置支持javascript脚本 |
| 112 | 112 | webView.getSettings().setJavaScriptEnabled(true); |
| 113 | 113 | webView.addJavascriptInterface(new JsObject(), "injectedObject"); | ... | ... |
core/base/src/main/java/top/zibin/luban/InputStreamProvider.java
| ... | ... | @@ -5,7 +5,7 @@ import java.io.InputStream; |
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | 7 | * 通过此接口获取输入流,以兼容文件、FileProvider方式获取到的图片 |
| 8 | - * <p> | |
| 8 | + * <presenter> | |
| 9 | 9 | * Get the input stream through this interface, and obtain the picture using compatible files and FileProvider |
| 10 | 10 | */ |
| 11 | 11 | public interface InputStreamProvider { | ... | ... |
core/base/src/main/java/top/zibin/luban/Luban.java
| ... | ... | @@ -314,8 +314,8 @@ public class Luban implements Handler.Callback { |
| 314 | 314 | /** |
| 315 | 315 | * Do I need to keep the image's alpha channel |
| 316 | 316 | * |
| 317 | - * @param focusAlpha <p> true - to keep alpha channel, the compress speed will be slow. </p> | |
| 318 | - * <p> false - don't keep alpha channel, it might have a black background.</p> | |
| 317 | + * @param focusAlpha <presenter> true - to keep alpha channel, the compress speed will be slow. </presenter> | |
| 318 | + * <presenter> false - don't keep alpha channel, it might have a black background.</presenter> | |
| 319 | 319 | */ |
| 320 | 320 | public Builder setFocusAlpha(boolean focusAlpha) { |
| 321 | 321 | this.focusAlpha = focusAlpha; | ... | ... |
core/base/src/main/java/top/zibin/luban/OnRenameListener.java
| ... | ... | @@ -3,16 +3,16 @@ package top.zibin.luban; |
| 3 | 3 | /** |
| 4 | 4 | * Author: zibin |
| 5 | 5 | * Datetime: 2018/5/18 |
| 6 | - * <p> | |
| 6 | + * <presenter> | |
| 7 | 7 | * 提供修改压缩图片命名接口 |
| 8 | - * <p> | |
| 8 | + * <presenter> | |
| 9 | 9 | * A functional interface (callback) that used to rename the file after compress. |
| 10 | 10 | */ |
| 11 | 11 | public interface OnRenameListener { |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * 压缩前调用该方法用于修改压缩后文件名 |
| 15 | - * <p> | |
| 15 | + * <presenter> | |
| 16 | 16 | * Call before compression begins. |
| 17 | 17 | * |
| 18 | 18 | * @param filePath 传入文件路径/ file path | ... | ... |