Commit 8217521b1a06265f5f421d44c6feb24354a9a0bc

Authored by YangShuai
1 parent c6b9ffa4

优化基类

Showing 22 changed files with 184 additions and 104 deletions
app/strike/src/main/java/com/cnlive/strike/MyFragment.java
1 package com.cnlive.strike; 1 package com.cnlive.strike;
2 2
  3 +import android.os.Bundle;
3 import android.util.Log; 4 import android.util.Log;
  5 +import android.view.LayoutInflater;
  6 +import android.view.View;
  7 +import android.view.ViewGroup;
  8 +
  9 +import androidx.annotation.NonNull;
  10 +import androidx.annotation.Nullable;
4 11
5 import com.cnlive.libs.base.mvp.BaseFragment; 12 import com.cnlive.libs.base.mvp.BaseFragment;
  13 +import com.hannesdorfmann.mosby3.mvp.MvpFragment;
6 14
7 public class MyFragment extends BaseFragment<MyFragmentView,MyPresenter> { 15 public class MyFragment extends BaseFragment<MyFragmentView,MyPresenter> {
  16 + @Nullable
  17 + @Override
  18 + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
  19 + return inflater.inflate(R.layout.activity_main1,container,false);
  20 + }
8 21
9 @Override 22 @Override
10 - protected int initLayout() {  
11 - return R.layout.activity_main1; 23 + protected void initView() {
  24 +// getMvpView().initView();
  25 + getPresenter().test();
12 } 26 }
13 27
14 @Override 28 @Override
15 - protected void init() {  
16 - Log.e(TAG, "init: "+TAG ); 29 + protected void initData() {
  30 +
17 } 31 }
  32 +
  33 +
18 } 34 }
app/strike/src/main/java/com/cnlive/strike/MyFragmentView.java
1 package com.cnlive.strike; 1 package com.cnlive.strike;
2 2
  3 +import android.util.Log;
  4 +
3 import com.cnlive.libs.base.mvp.BaseFragment; 5 import com.cnlive.libs.base.mvp.BaseFragment;
4 import com.cnlive.libs.base.mvp.BaseView; 6 import com.cnlive.libs.base.mvp.BaseView;
  7 +import com.cnlive.strike.databinding.ActivityMain1Binding;
  8 +import com.hannesdorfmann.mosby3.mvp.MvpView;
5 9
6 public class MyFragmentView extends BaseView { 10 public class MyFragmentView extends BaseView {
7 -  
8 -  
9 - public MyFragmentView(BaseFragment fragment) {  
10 - super(fragment);  
11 - }  
12 -  
13 - @Override  
14 - protected void initView() {  
15 - }  
16 -  
17 - @Override  
18 - protected void initData() {  
19 -  
20 - }  
21 -  
22 - public void test() { 11 + public void initView() {
  12 + Log.e(TAG, "initView: " + TAG);
23 } 13 }
24 } 14 }
app/strike/src/main/java/com/cnlive/strike/MyPresenter.java
1 package com.cnlive.strike; 1 package com.cnlive.strike;
2 2
3 import com.cnlive.libs.base.mvp.BasePresenter; 3 import com.cnlive.libs.base.mvp.BasePresenter;
  4 +import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
4 5
5 public class MyPresenter extends BasePresenter<MyFragmentView> { 6 public class MyPresenter extends BasePresenter<MyFragmentView> {
  7 + protected final String TAG = this.getClass().getSimpleName();
6 8
7 public void test() { 9 public void test() {
8 - getView().test(); 10 + getView().initView();
  11 +
9 } 12 }
10 } 13 }
core/base/src/main/java/com/cnlive/libs/base/media/picker/ImageCaptureManager.java
@@ -21,9 +21,9 @@ import java.util.Locale; @@ -21,9 +21,9 @@ import java.util.Locale;
21 21
22 /** 22 /**
23 * 创建:wukuiqing 23 * 创建:wukuiqing
24 - * <p> 24 + * <presenter>
25 * 时间:2018/3/22 25 * 时间:2018/3/22
26 - * <p> 26 + * <presenter>
27 * 描述: 相机操作 27 * 描述: 相机操作
28 */ 28 */
29 public class ImageCaptureManager { 29 public class ImageCaptureManager {
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,7 +312,7 @@ public class DiyCameraActivity extends AppCompatActivity implements Recyclerview
312 Media media = new Media(file.getPath(), file.getName(), enddutain, 3, file.length(), 0, "", enddutain); 312 Media media = new Media(file.getPath(), file.getName(), enddutain, 3, file.length(), 0, "", enddutain);
313 medias.add(media); 313 medias.add(media);
314 oldlist.add(media); 314 oldlist.add(media);
315 - CircleData.ReleaseVideoTypeListBean releaseVideoTypeListBean = releaseVideoTypeListBeans.get((Integer) v.getTag()); 315 + CircleData.ReleaseVideoTypeListBean releaseVideoTypeListBean = releaseVideoTypeListBeans.get((Integer) view.getTag());
316 intent.putParcelableArrayListExtra(PickerConfig.EXTRA_RESULT, oldlist); 316 intent.putParcelableArrayListExtra(PickerConfig.EXTRA_RESULT, oldlist);
317 intent.putExtra("isCircleVideo", "cancircle"); 317 intent.putExtra("isCircleVideo", "cancircle");
318 EventBus.getDefault().postSticky(new CircleChoose(releaseVideoTypeListBean)); 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,11 +9,11 @@ import android.view.MotionEvent;
9 /** 9 /**
10 * Hacky fix for Issue #4 and 10 * Hacky fix for Issue #4 and
11 * http://code.google.com/p/android/issues/detail?id=18990 11 * http://code.google.com/p/android/issues/detail?id=18990
12 - * <p/> 12 + * <presenter/>
13 * ScaleGestureDetector seems to mess up the touch events, which means that 13 * ScaleGestureDetector seems to mess up the touch events, which means that
14 * ViewGroups which make use of onInterceptTouchEvent throw a lot of 14 * ViewGroups which make use of onInterceptTouchEvent throw a lot of
15 * IllegalArgumentException: pointerIndex out of range. 15 * IllegalArgumentException: pointerIndex out of range.
16 - * <p/> 16 + * <presenter/>
17 * There's not much I can do in my code for now, but we can mask the result by 17 * There's not much I can do in my code for now, but we can mask the result by
18 * just catching the problem and ignoring it. 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 * Copyright 2016 oginotihiro 2 * Copyright 2016 oginotihiro
3 - * <p/> 3 + * <presenter/>
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at 6 * You may obtain a copy of the License at
7 - * <p/> 7 + * <presenter/>
8 * http://www.apache.org/licenses/LICENSE-2.0 8 * http://www.apache.org/licenses/LICENSE-2.0
9 - * <p/> 9 + * <presenter/>
10 * Unless required by applicable law or agreed to in writing, software 10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, 11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
core/base/src/main/java/com/cnlive/libs/base/mvp/BaseFragment.java
@@ -9,46 +9,56 @@ import androidx.annotation.NonNull; @@ -9,46 +9,56 @@ import androidx.annotation.NonNull;
9 import androidx.annotation.Nullable; 9 import androidx.annotation.Nullable;
10 import androidx.databinding.DataBindingUtil; 10 import androidx.databinding.DataBindingUtil;
11 import androidx.databinding.ViewDataBinding; 11 import androidx.databinding.ViewDataBinding;
  12 +
12 /** 13 /**
13 * @author ys 14 * @author ys
14 */ 15 */
15 public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V>> extends com.hannesdorfmann.mosby3.mvp.MvpFragment<V, P> { 16 public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V>> extends com.hannesdorfmann.mosby3.mvp.MvpFragment<V, P> {
16 - public V v;  
17 - public P p;  
18 - public ViewDataBinding binding; 17 + public V view;
  18 + public P presenter;
19 protected final String TAG = this.getClass().getSimpleName(); 19 protected final String TAG = this.getClass().getSimpleName();
20 20
21 - @Nullable  
22 - @Override  
23 - public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {  
24 - binding = DataBindingUtil.inflate(inflater, initLayout(), container, false);  
25 - return binding.getRoot();  
26 - }  
27 -  
28 @Override 21 @Override
29 public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { 22 public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
30 super.onViewCreated(view, savedInstanceState); 23 super.onViewCreated(view, savedInstanceState);
31 - if (null != getMvpView()&&null!=getPresenter()) {  
32 - init(); 24 + if (null != getMvpView() && null != getPresenter()) {
  25 + initView();
  26 + initData();
33 } 27 }
34 } 28 }
35 29
  30 + @NonNull
  31 + public V createView() {
  32 + return ReflectUtil.instanceView(0, this.getClass(), this, BaseView.class);
  33 + }
  34 +
36 @Override 35 @Override
37 public P createPresenter() { 36 public P createPresenter() {
38 - if (p == null) {  
39 - return ReflectUtil.instance(BasePresenter.class); 37 + return ReflectUtil.instancePresenter(1, this.getClass(), BasePresenter.class);
  38 + }
  39 +
  40 + @NonNull
  41 + @Override
  42 + public V getMvpView() {
  43 + if (null == view) {
  44 + return createView();
40 } else { 45 } else {
41 - return ReflectUtil.instance(1, this); 46 + return view;
42 } 47 }
43 } 48 }
44 49
  50 +// /**
  51 +// * 初始化布局
  52 +// *
  53 +// * @return 布局id
  54 +// */
  55 +// protected abstract int initLayout();
  56 +
45 /** 57 /**
46 - * 初始化布局  
47 - *  
48 - * @return 布局id 58 + * 初始化视图
49 */ 59 */
50 - protected abstract int initLayout(); 60 + protected abstract void initView();
51 61
52 - protected abstract void init(); 62 + protected abstract void initData();
53 63
54 } 64 }
core/base/src/main/java/com/cnlive/libs/base/mvp/BaseView.java
@@ -5,24 +5,17 @@ import android.app.Activity; @@ -5,24 +5,17 @@ import android.app.Activity;
5 import androidx.databinding.ViewDataBinding; 5 import androidx.databinding.ViewDataBinding;
6 6
7 import com.hannesdorfmann.mosby3.mvp.MvpView; 7 import com.hannesdorfmann.mosby3.mvp.MvpView;
  8 +
8 /** 9 /**
9 * @author ys 10 * @author ys
10 */ 11 */
11 -public abstract class BaseView implements MvpView {  
12 - private BaseFragment fragment;  
13 - protected ViewDataBinding binding;  
14 -  
15 - public BaseView(BaseFragment fragment) {  
16 - this.fragment = fragment;  
17 - this.binding = fragment.binding;  
18 - }  
19 -  
20 - public Activity getContext() {  
21 - return fragment == null ? null : fragment.getActivity();  
22 - }  
23 -  
24 - protected abstract void initView();  
25 -  
26 - protected abstract void initData();  
27 - 12 +public class BaseView implements MvpView {
  13 + protected final String TAG = this.getClass().getSimpleName();
  14 + protected ViewDataBinding rootBind;
  15 +
  16 +// public void initView() {
  17 +// }
  18 +//
  19 +// public void initData() {
  20 +// }
28 } 21 }
core/base/src/main/java/com/cnlive/libs/base/mvp/ReflectUtil.java
1 package com.cnlive.libs.base.mvp; 1 package com.cnlive.libs.base.mvp;
2 2
3 3
  4 +import android.util.Log;
  5 +
4 import java.lang.reflect.Constructor; 6 import java.lang.reflect.Constructor;
  7 +import java.lang.reflect.InvocationTargetException;
5 import java.lang.reflect.Method; 8 import java.lang.reflect.Method;
6 import java.lang.reflect.ParameterizedType; 9 import java.lang.reflect.ParameterizedType;
7 10
@@ -51,6 +54,7 @@ public class ReflectUtil { @@ -51,6 +54,7 @@ public class ReflectUtil {
51 return result; 54 return result;
52 } 55 }
53 56
  57 +
54 public static <R> R instance(Class type) { 58 public static <R> R instance(Class type) {
55 R result = null; 59 R result = null;
56 try { 60 try {
@@ -71,4 +75,68 @@ public class ReflectUtil { @@ -71,4 +75,68 @@ public class ReflectUtil {
71 } 75 }
72 return result; 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/ui/widget/arch/BottomMenuDialog.java
@@ -20,9 +20,9 @@ import java.util.List; @@ -20,9 +20,9 @@ import java.util.List;
20 20
21 /** 21 /**
22 * 创建:wukuiqing 22 * 创建:wukuiqing
23 - * <p> 23 + * <presenter>
24 * 时间:2018/1/8 24 * 时间:2018/1/8
25 - * <p> 25 + * <presenter>
26 * 描述:底部弹出的 Dialog 26 * 描述:底部弹出的 Dialog
27 */ 27 */
28 28
core/base/src/main/java/com/cnlive/libs/base/ui/widget/arch/BottomSheet.java
@@ -33,12 +33,12 @@ import java.util.List; @@ -33,12 +33,12 @@ import java.util.List;
33 33
34 /** 34 /**
35 * QMUIBottomSheet 在 {@link Dialog} 的基础上重新定制了 {@link #show()} 和 {@link #hide()} 时的动画效果, 使 {@link Dialog} 在界面底部升起和降下。 35 * QMUIBottomSheet 在 {@link Dialog} 的基础上重新定制了 {@link #show()} 和 {@link #hide()} 时的动画效果, 使 {@link Dialog} 在界面底部升起和降下。
36 - * <p> 36 + * <presenter>
37 * 提供了以下两种面板样式: 37 * 提供了以下两种面板样式:
38 * <ul> 38 * <ul>
39 * <li>列表样式, 使用 {@link BottomSheet.BottomListSheetBuilder} 生成。</li> 39 * <li>列表样式, 使用 {@link BottomSheet.BottomListSheetBuilder} 生成。</li>
40 * </ul> 40 * </ul>
41 - * </p> 41 + * </presenter>
42 */ 42 */
43 public class BottomSheet extends Dialog { 43 public class BottomSheet extends Dialog {
44 private static final String TAG = "QMUIBottomSheet"; 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,13 +46,13 @@ import com.cnlive.strike.base.R;
46 /** 46 /**
47 * 字母导航条 47 * 字母导航条
48 * 48 *
49 - * <p> 49 + * <presenter>
50 * 可用于需要按照字母排序的应用中. <br> 50 * 可用于需要按照字母排序的应用中. <br>
51 * 若排序的 item 首字为中文时,需要将每个 item 的首个汉字转化为拼音然后进行排序.<br>将汉字转换为拼音可用 pinyin4j.jar 来转换 51 * 若排序的 item 首字为中文时,需要将每个 item 的首个汉字转化为拼音然后进行排序.<br>将汉字转换为拼音可用 pinyin4j.jar 来转换
52 - * </p>  
53 - * <p> 52 + * </presenter>
  53 + * <presenter>
54 * 当点击导航条的字母时,会触发监听事件,若要监听,则可以使用 {@link #setOnLetterSelectListener(OnLetterSelectListener)} 来设置 54 * 当点击导航条的字母时,会触发监听事件,若要监听,则可以使用 {@link #setOnLetterSelectListener(OnLetterSelectListener)} 来设置
55 - * </p> 55 + * </presenter>
56 * 56 *
57 * @attr ref com.lwz.letterbarview.lib.R.styleable#LetterBar_lbLetterBarBackground 57 * @attr ref com.lwz.letterbarview.lib.R.styleable#LetterBar_lbLetterBarBackground
58 * @attr ref com.lwz.letterbarview.lib.R.styleable#LetterBar_lbLetterBarTextColor 58 * @attr ref com.lwz.letterbarview.lib.R.styleable#LetterBar_lbLetterBarTextColor
@@ -225,7 +225,7 @@ public class LetterBarView extends View { @@ -225,7 +225,7 @@ public class LetterBarView extends View {
225 225
226 /** 226 /**
227 * 计算字母导航条的参数 227 * 计算字母导航条的参数
228 - * <p> 根据字母的高度来计算 导航条的宽度 和 其在 X 轴的位置 228 + * <presenter> 根据字母的高度来计算 导航条的宽度 和 其在 X 轴的位置
229 */ 229 */
230 private void calculateLetterBarParams() { 230 private void calculateLetterBarParams() {
231 calculateLetterSpaceHeight(); 231 calculateLetterSpaceHeight();
core/base/src/main/java/com/cnlive/libs/base/util/BrandUtils.java
@@ -11,9 +11,9 @@ import java.util.Properties; @@ -11,9 +11,9 @@ import java.util.Properties;
11 11
12 /** 12 /**
13 * 作者: 吴奎庆 13 * 作者: 吴奎庆
14 - * <p> 14 + * <presenter>
15 * 时间: 2018/7/30 15 * 时间: 2018/7/30
16 - * <p> 16 + * <presenter>
17 * 简介: 17 * 简介:
18 */ 18 */
19 19
core/base/src/main/java/com/cnlive/libs/base/util/FileUtils.java
@@ -31,9 +31,9 @@ import static android.os.Environment.MEDIA_MOUNTED; @@ -31,9 +31,9 @@ import static android.os.Environment.MEDIA_MOUNTED;
31 31
32 /** 32 /**
33 * 作者: 吴奎庆 33 * 作者: 吴奎庆
34 - * <p> 34 + * <presenter>
35 * 时间: 2018/9/11 35 * 时间: 2018/9/11
36 - * <p> 36 + * <presenter>
37 * 简介: 37 * 简介:
38 */ 38 */
39 39
@@ -669,7 +669,7 @@ public class FileUtils { @@ -669,7 +669,7 @@ public class FileUtils {
669 669
670 /** 670 /**
671 * Return the files in directory. 671 * Return the files in directory.
672 - * <p>Doesn't traverse subdirectories</p> 672 + * <presenter>Doesn't traverse subdirectories</presenter>
673 * 673 *
674 * @param dirPath The path of directory. 674 * @param dirPath The path of directory.
675 * @return the files in directory 675 * @return the files in directory
@@ -680,7 +680,7 @@ public class FileUtils { @@ -680,7 +680,7 @@ public class FileUtils {
680 680
681 /** 681 /**
682 * Return the files in directory. 682 * Return the files in directory.
683 - * <p>Doesn't traverse subdirectories</p> 683 + * <presenter>Doesn't traverse subdirectories</presenter>
684 * 684 *
685 * @param dir The directory. 685 * @param dir The directory.
686 * @return the files in directory 686 * @return the files in directory
@@ -718,7 +718,7 @@ public class FileUtils { @@ -718,7 +718,7 @@ public class FileUtils {
718 718
719 /** 719 /**
720 * Return the files that satisfy the filter in directory. 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 * @param dirPath The path of directory. 723 * @param dirPath The path of directory.
724 * @param filter The filter. 724 * @param filter The filter.
@@ -731,7 +731,7 @@ public class FileUtils { @@ -731,7 +731,7 @@ public class FileUtils {
731 731
732 /** 732 /**
733 * Return the files that satisfy the filter in directory. 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 * @param dir The directory. 736 * @param dir The directory.
737 * @param filter The filter. 737 * @param filter The filter.
core/base/src/main/java/com/cnlive/libs/base/util/GlideRoundedCornersTransform.java
@@ -15,9 +15,9 @@ import java.security.MessageDigest; @@ -15,9 +15,9 @@ import java.security.MessageDigest;
15 15
16 /** 16 /**
17 * 作者: 吴奎庆 17 * 作者: 吴奎庆
18 - * <p> 18 + * <presenter>
19 * 时间: 2018/9/13 19 * 时间: 2018/9/13
20 - * <p> 20 + * <presenter>
21 * 简介: 21 * 简介:
22 */ 22 */
23 23
core/base/src/main/java/com/cnlive/libs/base/util/StatusBarUtil2.java
@@ -25,7 +25,7 @@ import java.lang.reflect.Method; @@ -25,7 +25,7 @@ import java.lang.reflect.Method;
25 25
26 /** 26 /**
27 * Created by Jaeger on 16/2/14. 27 * Created by Jaeger on 16/2/14.
28 - * <p> 28 + * <presenter>
29 * Email: chjie.jaeger@gmail.com 29 * Email: chjie.jaeger@gmail.com
30 * GitHub: https://github.com/laobie 30 * GitHub: https://github.com/laobie
31 */ 31 */
@@ -163,7 +163,7 @@ public class StatusBarUtil2 { @@ -163,7 +163,7 @@ public class StatusBarUtil2 {
163 163
164 /** 164 /**
165 * 使状态栏半透明 165 * 使状态栏半透明
166 - * <p> 166 + * <presenter>
167 * 适用于图片作为背景的界面,此时需要图片填充到状态栏 167 * 适用于图片作为背景的界面,此时需要图片填充到状态栏
168 * 168 *
169 * @param activity 需要设置的activity 169 * @param activity 需要设置的activity
@@ -174,7 +174,7 @@ public class StatusBarUtil2 { @@ -174,7 +174,7 @@ public class StatusBarUtil2 {
174 174
175 /** 175 /**
176 * 使状态栏半透明 176 * 使状态栏半透明
177 - * <p> 177 + * <presenter>
178 * 适用于图片作为背景的界面,此时需要图片填充到状态栏 178 * 适用于图片作为背景的界面,此时需要图片填充到状态栏
179 * 179 *
180 * @param activity 需要设置的activity 180 * @param activity 需要设置的activity
@@ -190,7 +190,7 @@ public class StatusBarUtil2 { @@ -190,7 +190,7 @@ public class StatusBarUtil2 {
190 190
191 /** 191 /**
192 * 针对根布局是 CoordinatorLayout, 使状态栏半透明 192 * 针对根布局是 CoordinatorLayout, 使状态栏半透明
193 - * <p> 193 + * <presenter>
194 * 适用于图片作为背景的界面,此时需要图片填充到状态栏 194 * 适用于图片作为背景的界面,此时需要图片填充到状态栏
195 * 195 *
196 * @param activity 需要设置的activity 196 * @param activity 需要设置的activity
@@ -219,7 +219,7 @@ public class StatusBarUtil2 { @@ -219,7 +219,7 @@ public class StatusBarUtil2 {
219 219
220 /** 220 /**
221 * 使状态栏透明(5.0以上半透明效果,不建议使用) 221 * 使状态栏透明(5.0以上半透明效果,不建议使用)
222 - * <p> 222 + * <presenter>
223 * 适用于图片作为背景的界面,此时需要图片填充到状态栏 223 * 适用于图片作为背景的界面,此时需要图片填充到状态栏
224 * 224 *
225 * @param activity 需要设置的activity 225 * @param activity 需要设置的activity
core/base/src/main/java/com/cnlive/libs/base/util/WebPreviewShowImg.java
@@ -2,9 +2,9 @@ package com.cnlive.libs.base.util; @@ -2,9 +2,9 @@ package com.cnlive.libs.base.util;
2 2
3 /** 3 /**
4 * 作者: 吴奎庆 4 * 作者: 吴奎庆
5 - * <p> 5 + * <presenter>
6 * 时间: 2019/1/30 6 * 时间: 2019/1/30
7 - * <p> 7 + * <presenter>
8 * 简介: 8 * 简介:
9 */ 9 */
10 public class WebPreviewShowImg { 10 public class WebPreviewShowImg {
core/base/src/main/java/com/cnlive/libs/base/util/WebViewUtil.java
@@ -22,7 +22,7 @@ public class WebViewUtil { @@ -22,7 +22,7 @@ public class WebViewUtil {
22 private static Activity context; 22 private static Activity context;
23 23
24 /** 24 /**
25 - * 将<p>标签转为html同时有回调 25 + * 将<presenter>标签转为html同时有回调
26 * 26 *
27 * @param pData 27 * @param pData
28 * @param webView 28 * @param webView
@@ -31,7 +31,7 @@ public class WebViewUtil { @@ -31,7 +31,7 @@ public class WebViewUtil {
31 public static void setPtoHtmlData(String pData, WebView webView, WebEleClickListener webEleClickListener) { 31 public static void setPtoHtmlData(String pData, WebView webView, WebEleClickListener webEleClickListener) {
32 if (null != webView) { 32 if (null != webView) {
33 webEleListener = webEleClickListener; 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 // 设置支持javascript脚本 35 // 设置支持javascript脚本
36 webView.getSettings().setJavaScriptEnabled(true); 36 webView.getSettings().setJavaScriptEnabled(true);
37 webView.addJavascriptInterface(new JsObject(), "injectedObject"); 37 webView.addJavascriptInterface(new JsObject(), "injectedObject");
@@ -59,7 +59,7 @@ public class WebViewUtil { @@ -59,7 +59,7 @@ public class WebViewUtil {
59 } 59 }
60 60
61 /** 61 /**
62 - * 将<p>标签转为html没有回调,直接跳转 62 + * 将<presenter>标签转为html没有回调,直接跳转
63 * 63 *
64 * @param activity 64 * @param activity
65 * @param pData 65 * @param pData
@@ -68,7 +68,7 @@ public class WebViewUtil { @@ -68,7 +68,7 @@ public class WebViewUtil {
68 public static void setPtoHtmlData(Activity activity, String pData, WebView webView) { 68 public static void setPtoHtmlData(Activity activity, String pData, WebView webView) {
69 if (null != webView) { 69 if (null != webView) {
70 context = activity; 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 // 设置支持javascript脚本 72 // 设置支持javascript脚本
73 webView.getSettings().setJavaScriptEnabled(true); 73 webView.getSettings().setJavaScriptEnabled(true);
74 webView.addJavascriptInterface(new JsObject(), "injectedObject"); 74 webView.addJavascriptInterface(new JsObject(), "injectedObject");
@@ -96,7 +96,7 @@ public class WebViewUtil { @@ -96,7 +96,7 @@ public class WebViewUtil {
96 } 96 }
97 97
98 /** 98 /**
99 - * 将<p>标签转为html没有回调,直接跳转,可指定文字大小 99 + * 将<presenter>标签转为html没有回调,直接跳转,可指定文字大小
100 * 100 *
101 * @param activity 101 * @param activity
102 * @param pData 102 * @param pData
@@ -107,7 +107,7 @@ public class WebViewUtil { @@ -107,7 +107,7 @@ public class WebViewUtil {
107 if (null != webView) { 107 if (null != webView) {
108 context = activity; 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 // 设置支持javascript脚本 111 // 设置支持javascript脚本
112 webView.getSettings().setJavaScriptEnabled(true); 112 webView.getSettings().setJavaScriptEnabled(true);
113 webView.addJavascriptInterface(new JsObject(), "injectedObject"); 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,7 +5,7 @@ import java.io.InputStream;
5 5
6 /** 6 /**
7 * 通过此接口获取输入流,以兼容文件、FileProvider方式获取到的图片 7 * 通过此接口获取输入流,以兼容文件、FileProvider方式获取到的图片
8 - * <p> 8 + * <presenter>
9 * Get the input stream through this interface, and obtain the picture using compatible files and FileProvider 9 * Get the input stream through this interface, and obtain the picture using compatible files and FileProvider
10 */ 10 */
11 public interface InputStreamProvider { 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,8 +314,8 @@ public class Luban implements Handler.Callback {
314 /** 314 /**
315 * Do I need to keep the image's alpha channel 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 public Builder setFocusAlpha(boolean focusAlpha) { 320 public Builder setFocusAlpha(boolean focusAlpha) {
321 this.focusAlpha = focusAlpha; 321 this.focusAlpha = focusAlpha;
core/base/src/main/java/top/zibin/luban/OnRenameListener.java
@@ -3,16 +3,16 @@ package top.zibin.luban; @@ -3,16 +3,16 @@ package top.zibin.luban;
3 /** 3 /**
4 * Author: zibin 4 * Author: zibin
5 * Datetime: 2018/5/18 5 * Datetime: 2018/5/18
6 - * <p> 6 + * <presenter>
7 * 提供修改压缩图片命名接口 7 * 提供修改压缩图片命名接口
8 - * <p> 8 + * <presenter>
9 * A functional interface (callback) that used to rename the file after compress. 9 * A functional interface (callback) that used to rename the file after compress.
10 */ 10 */
11 public interface OnRenameListener { 11 public interface OnRenameListener {
12 12
13 /** 13 /**
14 * 压缩前调用该方法用于修改压缩后文件名 14 * 压缩前调用该方法用于修改压缩后文件名
15 - * <p> 15 + * <presenter>
16 * Call before compression begins. 16 * Call before compression begins.
17 * 17 *
18 * @param filePath 传入文件路径/ file path 18 * @param filePath 传入文件路径/ file path