| | |
| | | * @desc 首页 Fragment的 ViewModel |
| | | */ |
| | | public class HomeFragmentViewModel extends BaseViewModel<DataRepository> { |
| | | private MutableLiveData<Integer> indexLiveData;//显示代数(0,1,2,3对应第一代,第二代,第三代,第四代) |
| | | private MutableLiveData<List<HomeRootBean>> homeRootBeanLiveData;//家根网成员列表 |
| | | |
| | | |
| | |
| | | |
| | | |
| | | public void getHomeRootBeanList() { |
| | | model.getHomeRoot("4") |
| | | model.getHomeRoot("1000") |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .doFinally(new Action() { |
| | | @Override |
| | |
| | | } |
| | | |
| | | |
| | | public void setIndexLiveData(MutableLiveData<Integer> indexLiveData) { |
| | | this.indexLiveData = indexLiveData; |
| | | } |
| | | |
| | | public MutableLiveData<Integer> getIndexLiveData() { |
| | | if (indexLiveData == null) { |
| | | indexLiveData = new MutableLiveData<>(); |
| | | indexLiveData.setValue(3); |
| | | } |
| | | return indexLiveData; |
| | | } |
| | | |
| | | public void setIndexLiveData(int index) { |
| | | if (indexLiveData == null) { |
| | | indexLiveData = new MutableLiveData<>(); |
| | | } |
| | | indexLiveData.setValue(index); |
| | | } |
| | | |
| | | public MutableLiveData<List<HomeRootBean>> getHomeRootBeanLiveData() { |
| | | if (homeRootBeanLiveData == null) { |