| | |
| | | /** |
| | | * 控制状态视图的LiveData |
| | | */ |
| | | protected MutableLiveData<StateViewEnum> stateViewLiveData; |
| | | protected MutableLiveData<String> messageLiveData; |
| | | protected MutableLiveData<StateViewEnum> stateViewLiveData = new MutableLiveData<>(); |
| | | protected MutableLiveData<String> messageLiveData = new MutableLiveData<>(); |
| | | //管理RxJava,主要针对RxJava异步操作造成的内存泄漏 |
| | | private CompositeDisposable mCompositeDisposable; |
| | | |
| | |
| | | } |
| | | return stateViewLiveData; |
| | | } |
| | | public LiveData<String> getMessageLivaData(){ |
| | | public MutableLiveData<String> getMessageLivaData(){ |
| | | if(messageLiveData == null){ |
| | | messageLiveData = new MutableLiveData<>(); |
| | | } |
| | |
| | | * 更改状态视图的状态 |
| | | */ |
| | | public void changeStateView(StateViewEnum state) { |
| | | stateViewLiveData.postValue(state); |
| | | stateViewLiveData.setValue(state); |
| | | } |
| | | |
| | | @Override |