From efafbbf142c81c233c71de636a2d3ce9dc2124f0 Mon Sep 17 00:00:00 2001 From: Linjiajia <319408893@qq.com> Date: 星期二, 12 九月 2023 19:20:05 +0800 Subject: [PATCH] 修复bug --- app/src/main/java/com/application/zhangshi_app_android/ui/function/GrowthExperienceActivityViewModel.java | 84 +++++++++++++++++++++++++++++++++--------- 1 files changed, 66 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/com/application/zhangshi_app_android/ui/function/GrowthExperienceActivityViewModel.java b/app/src/main/java/com/application/zhangshi_app_android/ui/function/GrowthExperienceActivityViewModel.java index 5aa4277..0255a1b 100644 --- a/app/src/main/java/com/application/zhangshi_app_android/ui/function/GrowthExperienceActivityViewModel.java +++ b/app/src/main/java/com/application/zhangshi_app_android/ui/function/GrowthExperienceActivityViewModel.java @@ -16,7 +16,6 @@ import com.application.zhangshi_app_android.bean.GrowthExperienceRelationshipBean; import com.application.zhangshi_app_android.data.DataRepository; -import java.util.HashMap; import java.util.List; import io.reactivex.Observer; @@ -27,12 +26,17 @@ * @desc 鎴愰暱缁忓巻 viewModel */ public class GrowthExperienceActivityViewModel extends BaseViewModel<DataRepository> { - private MutableLiveData<List<GrowthExperienceBean>> primaryLiveData;//鏁版嵁 - private MutableLiveData<GrowthExperienceInformationBean> infoLiveData; - private MutableLiveData<List<GrowthExperienceAutobiographyBean>> autobiographyLiveData; - private MutableLiveData<List<GrowthExperienceRelationshipBean>> relationLiveData; - private MutableLiveData<List<GrowthExperienceHolderConditionBean>> holderLiveData; - private MutableLiveData<List<GrowthExperienceAbroadConditionBean>> abroadLiveData; + private MutableLiveData<List<GrowthExperienceBean>> experienceListLiveData;//鎴愰暱缁忓巻鍒楄〃 + private MutableLiveData<GrowthExperienceInformationBean> infoLiveData;//涓汉淇℃伅 + private MutableLiveData<List<GrowthExperienceAutobiographyBean>> autobiographyLiveData;//鑷紶鍒楄〃 + private MutableLiveData<List<GrowthExperienceRelationshipBean>> relationLiveData;//鍏崇郴鍒楄〃 + private MutableLiveData<List<GrowthExperienceHolderConditionBean>> holderLiveData;//鎸佽瘉鎯呭喌鍒楄〃 + private MutableLiveData<List<GrowthExperienceAbroadConditionBean>> abroadLiveData;//鍑哄浗鎯呭喌鍒楄〃 + private MutableLiveData<Boolean> isExperienceExpendedLiveData;//鎴愰暱缁忓巻鏄惁灞曞紑 + private MutableLiveData<Boolean> isRelationExpendedLiveData;//鍏崇郴鏄惁灞曞紑 + private MutableLiveData<Boolean> isHolderExpendedLiveData;//鎸佽瘉鎯呭喌鏄惁灞曞紑 + private MutableLiveData<Boolean> isAbroadExpendedLiveData;//鍑哄浗鎯呭喌鏄惁灞曞紑 + public GrowthExperienceActivityViewModel(@NonNull Application application) { super(application); } @@ -57,7 +61,7 @@ @Override public void onNext(ResultData<List<GrowthExperienceBean>> data) { if (data.getCode() == CODE_SUCCESS){ - primaryLiveData.postValue(data.getData()); + experienceListLiveData.postValue(data.getData()); }else { messageLiveData.postValue(data.getMsg()); } @@ -125,8 +129,6 @@ public void onNext(ResultData<List<GrowthExperienceAutobiographyBean>> data) { if (data.getCode() == CODE_SUCCESS) { if (autobiographyLiveData != null) { - //杩欎竴鐪嬪氨鏄凡缁忚幏鍙栧埌鏁版嵁浜嗭紝娌℃硶鏄剧ず灏辨槸浣犲啓鐨勪唬鐮侀棶棰橈紝鑷繁鎵鹃棶棰樺晩 - //灏辩粰livedata璁剧疆鏁版嵁锛岀劧鍚庡憿锛屽畠鐨勬暟鎹敼鍙樺悗锛岃皝鏉ュ彂鐢焨i鍙樺寲锛岃瀵熻�呭憿锛燂紵锛熻皝鏄瀵熻�� autobiographyLiveData.postValue(data.getData()); } } else { @@ -135,8 +137,6 @@ } } } - - @Override public void onError(Throwable e) { messageLiveData.postValue(e.getMessage()); @@ -253,15 +253,15 @@ - public MutableLiveData<List<GrowthExperienceBean>> getPrimaryLiveData() { - if (primaryLiveData == null){ - primaryLiveData = new MutableLiveData<>(); + public MutableLiveData<List<GrowthExperienceBean>> getExperienceListLiveData() { + if (experienceListLiveData == null){ + experienceListLiveData = new MutableLiveData<>(); } - return primaryLiveData; + return experienceListLiveData; } - public void setPrimaryLiveData(MutableLiveData<List<GrowthExperienceBean>> primaryLiveData) { - this.primaryLiveData = primaryLiveData; + public void setExperienceListLiveData(MutableLiveData<List<GrowthExperienceBean>> experienceListLiveData) { + this.experienceListLiveData = experienceListLiveData; } public MutableLiveData<List<GrowthExperienceRelationshipBean>> getRelationLiveData() { @@ -319,4 +319,52 @@ public void setAutobiographyLiveData(MutableLiveData<List<GrowthExperienceAutobiographyBean>> autobiographyLiveData) { this.autobiographyLiveData = autobiographyLiveData; } + + public MutableLiveData<Boolean> getIsExperienceExpendedLiveData() { + if (isExperienceExpendedLiveData == null){ + isExperienceExpendedLiveData = new MutableLiveData<>(); + isExperienceExpendedLiveData.setValue(false); + } + return isExperienceExpendedLiveData; + } + + public void setIsExperienceExpendedLiveData(MutableLiveData<Boolean> isExperienceExpendedLiveData) { + this.isExperienceExpendedLiveData = isExperienceExpendedLiveData; + } + + public MutableLiveData<Boolean> getIsRelationExpendedLiveData() { + if (isRelationExpendedLiveData == null){ + isRelationExpendedLiveData = new MutableLiveData<>(); + isRelationExpendedLiveData.setValue(false); + } + return isRelationExpendedLiveData; + } + + public void setIsRelationExpendedLiveData(MutableLiveData<Boolean> isRelationExpendedLiveData) { + this.isRelationExpendedLiveData = isRelationExpendedLiveData; + } + + public MutableLiveData<Boolean> getIsHolderExpendedLiveData() { + if (isHolderExpendedLiveData == null){ + isHolderExpendedLiveData = new MutableLiveData<>(); + isHolderExpendedLiveData.setValue(false); + } + return isHolderExpendedLiveData; + } + + public void setIsHolderExpendedLiveData(MutableLiveData<Boolean> isHolderExpendedLiveData) { + this.isHolderExpendedLiveData = isHolderExpendedLiveData; + } + + public MutableLiveData<Boolean> getIsAbroadExpendedLiveData() { + if (isAbroadExpendedLiveData == null){ + isAbroadExpendedLiveData = new MutableLiveData<>(); + isAbroadExpendedLiveData.setValue(false); + } + return isAbroadExpendedLiveData; + } + + public void setIsAbroadExpendedLiveData(MutableLiveData<Boolean> isAbroadExpendedLiveData) { + this.isAbroadExpendedLiveData = isAbroadExpendedLiveData; + } } -- Gitblit v1.9.1