|
@@ -1,10 +1,11 @@
|
|
|
package com.miekir.newmvp.main.presenter;
|
|
package com.miekir.newmvp.main.presenter;
|
|
|
|
|
|
|
|
import com.miekir.common.utils.LogTool;
|
|
import com.miekir.common.utils.LogTool;
|
|
|
|
|
+import com.miekir.mvp.constant.MvpRepository;
|
|
|
import com.miekir.mvp.presenter.BasePresenter;
|
|
import com.miekir.mvp.presenter.BasePresenter;
|
|
|
-import com.miekir.newmvp.main.model.IMainModel;
|
|
|
|
|
-import com.miekir.newmvp.main.model.MainFileModel;
|
|
|
|
|
-import com.miekir.newmvp.main.model.MainNetModel;
|
|
|
|
|
|
|
+import com.miekir.newmvp.main.model.user.IUserModel;
|
|
|
|
|
+import com.miekir.newmvp.main.model.user.UserFileModel;
|
|
|
|
|
+import com.miekir.newmvp.main.model.user.UserNetModel;
|
|
|
import com.miekir.newmvp.main.view.IMainView;
|
|
import com.miekir.newmvp.main.view.IMainView;
|
|
|
|
|
|
|
|
import io.reactivex.Observable;
|
|
import io.reactivex.Observable;
|
|
@@ -20,22 +21,20 @@ import io.reactivex.schedulers.Schedulers;
|
|
|
* @date 2020/11/18 14:27
|
|
* @date 2020/11/18 14:27
|
|
|
* Description:
|
|
* Description:
|
|
|
*/
|
|
*/
|
|
|
-public class MainPresenter extends BasePresenter<IMainView> {
|
|
|
|
|
- public static final int REPO_NET = 1;
|
|
|
|
|
- public static final int REPO_FILE = 2;
|
|
|
|
|
- private IMainModel mMainModel;
|
|
|
|
|
|
|
+public class UserPresenter extends BasePresenter<IMainView> {
|
|
|
|
|
+ private IUserModel mModel;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 设置当前仓库
|
|
* 设置当前仓库
|
|
|
- * @param repository 仓库
|
|
|
|
|
|
|
+ * @param type 仓库
|
|
|
*/
|
|
*/
|
|
|
- public void setRepository(int repository) {
|
|
|
|
|
- switch (repository) {
|
|
|
|
|
- case REPO_NET:
|
|
|
|
|
- mMainModel = new MainNetModel();
|
|
|
|
|
|
|
+ public void setRepoType(int type) {
|
|
|
|
|
+ switch (type) {
|
|
|
|
|
+ case MvpRepository.REPO_NET:
|
|
|
|
|
+ mModel = new UserNetModel();
|
|
|
break;
|
|
break;
|
|
|
- case REPO_FILE:
|
|
|
|
|
- mMainModel = new MainFileModel();
|
|
|
|
|
|
|
+ case MvpRepository.REPO_FILE:
|
|
|
|
|
+ mModel = new UserFileModel();
|
|
|
break;
|
|
break;
|
|
|
default:
|
|
default:
|
|
|
break;
|
|
break;
|
|
@@ -44,14 +43,14 @@ public class MainPresenter extends BasePresenter<IMainView> {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void onInit() {
|
|
public void onInit() {
|
|
|
- mMainModel = new MainNetModel();
|
|
|
|
|
|
|
+ mModel = new UserNetModel();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 让具体的Model去执行任务
|
|
* 让具体的Model去执行任务
|
|
|
*/
|
|
*/
|
|
|
- public void getData() {
|
|
|
|
|
- mMainModel.goGetData(bean -> {
|
|
|
|
|
|
|
+ public void getUserData() {
|
|
|
|
|
+ mModel.getData(bean -> {
|
|
|
// 执行完毕,回调
|
|
// 执行完毕,回调
|
|
|
getCallbackView().onMainResult();
|
|
getCallbackView().onMainResult();
|
|
|
});
|
|
});
|