|
@@ -32,20 +32,20 @@ public abstract class BasePresenter extends ViewModel {
|
|
|
return dialogLiveData;
|
|
return dialogLiveData;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private List<BeanLiveData<?>> liveDataList = new CopyOnWriteArrayList<>();
|
|
|
|
|
- public List<BeanLiveData<?>> getLiveDataList() {
|
|
|
|
|
|
|
+ private List<BeanLiveData<?, ?>> liveDataList = new CopyOnWriteArrayList<>();
|
|
|
|
|
+ public List<BeanLiveData<?, ?>> getLiveDataList() {
|
|
|
return liveDataList;
|
|
return liveDataList;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- protected <T> BeanLiveData<T> getLiveData(boolean withProgress) {
|
|
|
|
|
|
|
+ protected <T, C> BeanLiveData<T, C> getLiveData(boolean withProgress) {
|
|
|
if (withProgress) {
|
|
if (withProgress) {
|
|
|
showLoading();
|
|
showLoading();
|
|
|
}
|
|
}
|
|
|
- BeanLiveData<T> liveData = new BeanLiveData<>(this, withProgress);
|
|
|
|
|
|
|
+ BeanLiveData<T, C> liveData = new BeanLiveData<>(this, withProgress);
|
|
|
liveDataList.add(liveData);
|
|
liveDataList.add(liveData);
|
|
|
return liveData;
|
|
return liveData;
|
|
|
}
|
|
}
|
|
|
- protected <T> BeanLiveData<T> getLiveData() {
|
|
|
|
|
|
|
+ protected <T> BeanLiveData<T, ?> getLiveData() {
|
|
|
return getLiveData(false);
|
|
return getLiveData(false);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -85,7 +85,7 @@ public abstract class BasePresenter extends ViewModel {
|
|
|
* 当任务被取消时,界面还存在
|
|
* 当任务被取消时,界面还存在
|
|
|
*/
|
|
*/
|
|
|
public void onTaskCancel() {
|
|
public void onTaskCancel() {
|
|
|
- for (BeanLiveData<?> liveData : liveDataList) {
|
|
|
|
|
|
|
+ for (BeanLiveData<?, ?> liveData : liveDataList) {
|
|
|
liveData.cancelObserve();
|
|
liveData.cancelObserve();
|
|
|
}
|
|
}
|
|
|
liveDataList.clear();
|
|
liveDataList.clear();
|