|
|
@@ -5,8 +5,8 @@ import androidx.lifecycle.ViewModel;
|
|
|
|
|
|
import com.miekir.mvp.bean.DataResult;
|
|
|
import com.miekir.mvp.constant.DialogAction;
|
|
|
-import com.miekir.mvp.jetpack.BeanLiveData;
|
|
|
-import com.miekir.mvp.jetpack.MvpLiveData;
|
|
|
+import com.miekir.mvp.jetpack.RawLiveData;
|
|
|
+import com.miekir.mvp.jetpack.WrapLiveData;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.concurrent.CopyOnWriteArrayList;
|
|
|
@@ -33,8 +33,8 @@ public abstract class BasePresenter extends ViewModel {
|
|
|
return dialogLiveData;
|
|
|
}
|
|
|
|
|
|
- private List<MvpLiveData<?, ?>> liveDataList = new CopyOnWriteArrayList<>();
|
|
|
- public List<MvpLiveData<?, ?>> getLiveDataList() {
|
|
|
+ private List<RawLiveData<?, ?>> liveDataList = new CopyOnWriteArrayList<>();
|
|
|
+ public List<RawLiveData<?, ?>> getLiveDataList() {
|
|
|
return liveDataList;
|
|
|
}
|
|
|
|
|
|
@@ -44,19 +44,19 @@ public abstract class BasePresenter extends ViewModel {
|
|
|
* @param <T> 监听者里面的数据类型
|
|
|
* @param <C> 返回的任务,应该是可取消的类型
|
|
|
*/
|
|
|
- protected <T, C> BeanLiveData<T, C> getWrapperLiveData(boolean withProgress) {
|
|
|
+ protected <T, C> WrapLiveData<T, C> getWrapperLiveData(boolean withProgress) {
|
|
|
if (withProgress) {
|
|
|
showLoading();
|
|
|
}
|
|
|
- BeanLiveData<T, C> liveData = new BeanLiveData<>(this, withProgress);
|
|
|
+ WrapLiveData<T, C> liveData = new WrapLiveData<>(this, withProgress);
|
|
|
liveDataList.add(liveData);
|
|
|
return liveData;
|
|
|
}
|
|
|
- protected <T, C> MvpLiveData<T, C> getRawLiveData(boolean withProgress) {
|
|
|
+ protected <T, C> RawLiveData<T, C> getRawLiveData(boolean withProgress) {
|
|
|
if (withProgress) {
|
|
|
showLoading();
|
|
|
}
|
|
|
- MvpLiveData<T, C> liveData = new MvpLiveData<>(this, withProgress);
|
|
|
+ RawLiveData<T, C> liveData = new RawLiveData<>(this, withProgress);
|
|
|
liveDataList.add(liveData);
|
|
|
return liveData;
|
|
|
}
|
|
|
@@ -107,7 +107,7 @@ public abstract class BasePresenter extends ViewModel {
|
|
|
* 当任务被取消时,界面还存在
|
|
|
*/
|
|
|
public void onTaskCancel() {
|
|
|
- for (MvpLiveData<?, ?> liveData : liveDataList) {
|
|
|
+ for (RawLiveData<?, ?> liveData : liveDataList) {
|
|
|
liveData.cancelObserve();
|
|
|
}
|
|
|
liveDataList.clear();
|