| | |
| | | import com.android.app_base.base.StateViewEnum; |
| | | import com.android.app_base.base.model.BaseModel; |
| | | |
| | | |
| | | import org.reactivestreams.Subscriber; |
| | | |
| | | import io.reactivex.disposables.CompositeDisposable; |
| | | import io.reactivex.disposables.Disposable; |
| | | |
| | |
| | | /** |
| | | * 控制状态视图的LiveData |
| | | */ |
| | | private MutableLiveData<StateViewEnum> stateViewLiveData; |
| | | protected MutableLiveData<StateViewEnum> stateViewLiveData; |
| | | protected MutableLiveData<String> messageLiveData; |
| | | //管理RxJava,主要针对RxJava异步操作造成的内存泄漏 |
| | | private CompositeDisposable mCompositeDisposable; |
| | | |
| | |
| | | |
| | | /** |
| | | * Rxjava的异步操作都要调用此方法添加到 mCompositeDisposable里, |
| | | * @param disposable |
| | | */ |
| | | protected void addSubscribe(Disposable disposable) { |
| | | if (mCompositeDisposable == null) { |
| | |
| | | } |
| | | return stateViewLiveData; |
| | | } |
| | | public LiveData<String> getMessageLivaData(){ |
| | | if(messageLiveData == null){ |
| | | messageLiveData = new MutableLiveData<>(); |
| | | } |
| | | return messageLiveData; |
| | | } |
| | | /** |
| | | * 更改状态视图的状态 |
| | | */ |