| | |
| | | import com.android.app_base.base.StateViewEnum; |
| | | import com.android.app_base.base.viewmodel.BaseViewModel; |
| | | import com.android.app_base.http.ResultData; |
| | | import com.android.app_base.manager.UserManager; |
| | | import com.android.app_base.utils.RxUtils; |
| | | import com.application.zhangshi_app_android.bean.AnnualHealthStatusBean; |
| | | import com.application.zhangshi_app_android.bean.HomeRootBean; |
| | |
| | | * @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") |
| | | String clanId = UserManager.getInstance().getClanId(); |
| | | model.getHomeRoot("1000", clanId) |
| | | .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) { |