|
@@ -10,6 +10,7 @@ import com.miekir.mvp.constant.DialogAction;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.concurrent.CopyOnWriteArrayList;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Copyright (C), 2019-2020, Miekir
|
|
* Copyright (C), 2019-2020, Miekir
|
|
@@ -25,25 +26,15 @@ public abstract class BasePresenter extends ViewModel {
|
|
|
* liveData在ViewModel(Presenter)创建,然后提供方法给Activity获取,方便取消观察
|
|
* liveData在ViewModel(Presenter)创建,然后提供方法给Activity获取,方便取消观察
|
|
|
*/
|
|
*/
|
|
|
private MutableLiveData<DataResult> liveData = new MutableLiveData<DataResult>();
|
|
private MutableLiveData<DataResult> liveData = new MutableLiveData<DataResult>();
|
|
|
- /**
|
|
|
|
|
- * 由于使用了AspectJ,这个变量名和属性不能改动,否则AspectJ会拿不到值
|
|
|
|
|
- */
|
|
|
|
|
private MutableLiveData<DataResult> dialogLiveData = new MutableLiveData<DataResult>();
|
|
private MutableLiveData<DataResult> dialogLiveData = new MutableLiveData<DataResult>();
|
|
|
-
|
|
|
|
|
public MutableLiveData<DataResult> getLiveData() {
|
|
public MutableLiveData<DataResult> getLiveData() {
|
|
|
return liveData;
|
|
return liveData;
|
|
|
}
|
|
}
|
|
|
public MutableLiveData<DataResult> getDialogLiveData() {
|
|
public MutableLiveData<DataResult> getDialogLiveData() {
|
|
|
return dialogLiveData;
|
|
return dialogLiveData;
|
|
|
}
|
|
}
|
|
|
|
|
+ private List<MutableLiveData<Object>> specificLiveDataList = new CopyOnWriteArrayList<>();
|
|
|
|
|
|
|
|
- private List<MutableLiveData<Object>> specificLiveDataList = new ArrayList<>();
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 由于使用了AspectJ,这个方法名不能改动
|
|
|
|
|
- * 对弹出对话框此时进行计数,归零才dismiss
|
|
|
|
|
- */
|
|
|
|
|
public void showLoading() {
|
|
public void showLoading() {
|
|
|
showLoading("");
|
|
showLoading("");
|
|
|
}
|
|
}
|
|
@@ -52,16 +43,14 @@ public abstract class BasePresenter extends ViewModel {
|
|
|
if (dialogLiveData == null) {
|
|
if (dialogLiveData == null) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- // todo 解决加载框的问题
|
|
|
|
|
- //dialogLiveData.postValue(new DataResult(0, message, null, DialogAction.DIALOG_SHOW));
|
|
|
|
|
|
|
+ dialogLiveData.postValue(new DataResult(0, message, null, DialogAction.DIALOG_SHOW));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void dismissLoading() {
|
|
public void dismissLoading() {
|
|
|
if (dialogLiveData == null) {
|
|
if (dialogLiveData == null) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- // todo 解决加载框的问题
|
|
|
|
|
- //dialogLiveData.postValue(new DataResult(0, null, null, DialogAction.DIALOG_DISMISS));
|
|
|
|
|
|
|
+ dialogLiveData.postValue(new DataResult(0, null, null, DialogAction.DIALOG_DISMISS));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|