Commit 33043854c8390e62d0af69a5264f73397a387308
1 parent
977b3347
upload libs mosby3 mvp
Showing
7 changed files
with
16 additions
and
58 deletions
app/src/main/java/com/cnlive/libs/demo/mvptest/frame/ILaunchView.java
app/src/main/java/com/cnlive/libs/demo/mvptest/frame/presenter/LaunchPresenter.java
| ... | ... | @@ -11,7 +11,7 @@ import com.cnlive.libs.demo.data.network.testapi.ApiRequest; |
| 11 | 11 | import com.cnlive.libs.demo.data.network.testapi.ApiService; |
| 12 | 12 | import com.cnlive.libs.demo.mvptest.frame.ILaunchView; |
| 13 | 13 | import com.cnlive.libs.demo.mvptest.frame.view.LaunchView; |
| 14 | -import com.hannesdorfmann.mosby.mvp.MvpBasePresenter; | |
| 14 | +import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | |
| 15 | 15 | |
| 16 | 16 | import io.reactivex.disposables.Disposable; |
| 17 | 17 | ... | ... |
cnlive/build.gradle
| ... | ... | @@ -29,7 +29,10 @@ dependencies { |
| 29 | 29 | compile fileTree(include: ['*.jar'], dir: 'libs') |
| 30 | 30 | |
| 31 | 31 | //MVP |
| 32 | - compile 'com.hannesdorfmann.mosby:mvp:2.0.1' | |
| 32 | + compile 'com.hannesdorfmann.mosby3:mvp:3.0.4' | |
| 33 | + compile 'com.hannesdorfmann.mosby3:viewstate:3.0.4' | |
| 34 | + compile 'com.hannesdorfmann.mosby3:mvp-lce:3.0.4' | |
| 35 | + compile 'com.hannesdorfmann.mosby3:mvp-nullobject-presenter:3.0.4' | |
| 33 | 36 | //GSON |
| 34 | 37 | compile 'com.google.code.gson:gson:2.7' |
| 35 | 38 | //RxJava | ... | ... |
cnlive/src/main/java/com/cnlive/libs/base/activity/MvpActivity.java
| ... | ... | @@ -4,15 +4,15 @@ import android.os.Bundle; |
| 4 | 4 | import android.support.annotation.NonNull; |
| 5 | 5 | |
| 6 | 6 | import com.cnlive.libs.base.util.ReflectUtil; |
| 7 | -import com.hannesdorfmann.mosby.mvp.MvpPresenter; | |
| 8 | -import com.hannesdorfmann.mosby.mvp.MvpView; | |
| 7 | +import com.hannesdorfmann.mosby3.mvp.MvpPresenter; | |
| 8 | +import com.hannesdorfmann.mosby3.mvp.MvpView; | |
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * MVP Databinding Base Activity |
| 12 | 12 | * @param <V> MVP View {@link MvpView} |
| 13 | 13 | * @param <P> MVP Presenter {@link MvpPresenter} |
| 14 | 14 | */ |
| 15 | -public abstract class MvpActivity<V extends MvpView, P extends MvpPresenter<V>> extends com.hannesdorfmann.mosby.mvp.MvpActivity<V, P> { | |
| 15 | +public abstract class MvpActivity<V extends MvpView, P extends MvpPresenter<V>> extends com.hannesdorfmann.mosby3.mvp.MvpActivity<V, P> { | |
| 16 | 16 | |
| 17 | 17 | public V view; |
| 18 | 18 | ... | ... |
cnlive/src/main/java/com/cnlive/libs/base/activity/MvpBindingActivity.java
| ... | ... | @@ -6,9 +6,8 @@ import android.os.Bundle; |
| 6 | 6 | import android.support.annotation.NonNull; |
| 7 | 7 | |
| 8 | 8 | import com.cnlive.libs.base.util.ReflectUtil; |
| 9 | -import com.hannesdorfmann.mosby.mvp.MvpActivity; | |
| 10 | -import com.hannesdorfmann.mosby.mvp.MvpPresenter; | |
| 11 | -import com.hannesdorfmann.mosby.mvp.MvpView; | |
| 9 | +import com.hannesdorfmann.mosby3.mvp.MvpPresenter; | |
| 10 | +import com.hannesdorfmann.mosby3.mvp.MvpView; | |
| 12 | 11 | |
| 13 | 12 | /** |
| 14 | 13 | * MVP Databinding Base Activity |
| ... | ... | @@ -19,7 +18,6 @@ import com.hannesdorfmann.mosby.mvp.MvpView; |
| 19 | 18 | */ |
| 20 | 19 | public abstract class MvpBindingActivity<V extends MvpView, P extends MvpPresenter<V>, D, T extends ViewDataBinding> extends MvpActivity<V, P> { |
| 21 | 20 | |
| 22 | - public V view; | |
| 23 | 21 | public T binding; |
| 24 | 22 | public D data; |
| 25 | 23 | |
| ... | ... | @@ -30,31 +28,11 @@ public abstract class MvpBindingActivity<V extends MvpView, P extends MvpPresent |
| 30 | 28 | ReflectUtil.invoke(binding, "setData", getViewData()); |
| 31 | 29 | } |
| 32 | 30 | |
| 33 | - protected abstract int getLayoutId(); | |
| 34 | - | |
| 35 | 31 | protected D initLayoutData() { |
| 36 | 32 | return ReflectUtil.instance(2, this); |
| 37 | 33 | } |
| 38 | 34 | |
| 39 | 35 | @NonNull |
| 40 | - public V createView() { | |
| 41 | - return ReflectUtil.instance(0, this.getClass(), this); | |
| 42 | - } | |
| 43 | - | |
| 44 | - @NonNull | |
| 45 | - @Override | |
| 46 | - public P createPresenter() { | |
| 47 | - return ReflectUtil.instance(1, this); | |
| 48 | - } | |
| 49 | - | |
| 50 | - @NonNull | |
| 51 | - @Override | |
| 52 | - public V getMvpView() { | |
| 53 | - if (view == null) view = createView(); | |
| 54 | - return view; | |
| 55 | - } | |
| 56 | - | |
| 57 | - @NonNull | |
| 58 | 36 | public D getViewData() { |
| 59 | 37 | if(data == null) data = initLayoutData(); |
| 60 | 38 | return data; | ... | ... |
cnlive/src/main/java/com/cnlive/libs/base/fragment/MvpBindingFragment.java
| ... | ... | @@ -10,9 +10,8 @@ import android.view.View; |
| 10 | 10 | import android.view.ViewGroup; |
| 11 | 11 | |
| 12 | 12 | import com.cnlive.libs.base.util.ReflectUtil; |
| 13 | -import com.hannesdorfmann.mosby.mvp.MvpFragment; | |
| 14 | -import com.hannesdorfmann.mosby.mvp.MvpPresenter; | |
| 15 | -import com.hannesdorfmann.mosby.mvp.MvpView; | |
| 13 | +import com.hannesdorfmann.mosby3.mvp.MvpPresenter; | |
| 14 | +import com.hannesdorfmann.mosby3.mvp.MvpView; | |
| 16 | 15 | |
| 17 | 16 | /** |
| 18 | 17 | * MVP Databinding Base Fragment |
| ... | ... | @@ -23,7 +22,6 @@ import com.hannesdorfmann.mosby.mvp.MvpView; |
| 23 | 22 | */ |
| 24 | 23 | public abstract class MvpBindingFragment<V extends MvpView, P extends MvpPresenter<V>, D, T extends ViewDataBinding> extends MvpFragment<V, P> { |
| 25 | 24 | |
| 26 | - public V view; | |
| 27 | 25 | public T binding; |
| 28 | 26 | public D data; |
| 29 | 27 | |
| ... | ... | @@ -35,32 +33,11 @@ public abstract class MvpBindingFragment<V extends MvpView, P extends MvpPresent |
| 35 | 33 | return binding.getRoot(); |
| 36 | 34 | } |
| 37 | 35 | |
| 38 | - protected abstract int getLayoutId(); | |
| 39 | - | |
| 40 | 36 | protected D initLayoutData() { |
| 41 | 37 | return ReflectUtil.instance(2, this); |
| 42 | 38 | } |
| 43 | 39 | |
| 44 | 40 | @NonNull |
| 45 | - public V createView() { | |
| 46 | - return ReflectUtil.instance(0, this.getClass(), this); | |
| 47 | - } | |
| 48 | - | |
| 49 | - @NonNull | |
| 50 | - @Override | |
| 51 | - public P createPresenter() { | |
| 52 | - return ReflectUtil.instance(1, this); | |
| 53 | - } | |
| 54 | - | |
| 55 | - @NonNull | |
| 56 | - @Override | |
| 57 | - public V getMvpView() { | |
| 58 | - if (view == null) view = createView(); | |
| 59 | - return view; | |
| 60 | - } | |
| 61 | - | |
| 62 | - | |
| 63 | - @NonNull | |
| 64 | 41 | public D getViewData() { |
| 65 | 42 | if(data == null) data = initLayoutData(); |
| 66 | 43 | return data; | ... | ... |
cnlive/src/main/java/com/cnlive/libs/base/fragment/MvpFragment.java
| ... | ... | @@ -8,8 +8,8 @@ import android.view.View; |
| 8 | 8 | import android.view.ViewGroup; |
| 9 | 9 | |
| 10 | 10 | import com.cnlive.libs.base.util.ReflectUtil; |
| 11 | -import com.hannesdorfmann.mosby.mvp.MvpPresenter; | |
| 12 | -import com.hannesdorfmann.mosby.mvp.MvpView; | |
| 11 | +import com.hannesdorfmann.mosby3.mvp.MvpPresenter; | |
| 12 | +import com.hannesdorfmann.mosby3.mvp.MvpView; | |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * MVP Databinding Base Fragment |
| ... | ... | @@ -17,7 +17,7 @@ import com.hannesdorfmann.mosby.mvp.MvpView; |
| 17 | 17 | * @param <V> MVP View {@link MvpView} |
| 18 | 18 | * @param <P> MVP Presenter {@link MvpPresenter} |
| 19 | 19 | */ |
| 20 | -public abstract class MvpFragment<V extends MvpView, P extends MvpPresenter<V>> extends com.hannesdorfmann.mosby.mvp.MvpFragment<V, P> { | |
| 20 | +public abstract class MvpFragment<V extends MvpView, P extends MvpPresenter<V>> extends com.hannesdorfmann.mosby3.mvp.MvpFragment<V, P> { | |
| 21 | 21 | |
| 22 | 22 | public V view; |
| 23 | 23 | ... | ... |