package com.application.zhangshi_app_android.ui.function; import android.app.Application; import androidx.annotation.NonNull; import androidx.lifecycle.MutableLiveData; import com.android.app_base.base.viewmodel.BaseViewModel; import com.application.zhangshi_app_android.bean.PropertyBean; import com.application.zhangshi_app_android.data.DataRepository; import java.util.ArrayList; import java.util.List; /** * @author Ljj * @date 2023.04.21. 19:10 * @desc 个人财产 ViewModel */ public class PropertyActivityViewModel extends BaseViewModel { private MutableLiveData> dataListLiveData; public PropertyActivityViewModel(@NonNull Application application) { super(application); } @Override protected DataRepository initModel() { return DataRepository.getInstance(); } public MutableLiveData> getDataListLiveData() { if (dataListLiveData == null) { dataListLiveData = new MutableLiveData<>(); } return dataListLiveData; } public void setDataListLiveData(MutableLiveData> dataListLiveData) { this.dataListLiveData = dataListLiveData; } public void getProperty() { List cleanStorageBeans = new ArrayList<>(); for (int i = 0; i < 10; i++) { PropertyBean bean = new PropertyBean(); bean.setType("房产"); bean.setName("房产"); bean.setPrice("1000"); bean.setCreateTime("2020-01-01"); bean.setTerm("2020-01-01"); bean.setStatus("变更"); bean.setPropertyRight("产权"); bean.setLocation("位置"); bean.setRemark("备注"); cleanStorageBeans.add(bean); } dataListLiveData.setValue(cleanStorageBeans); } }