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.HundredWishBean;
|
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.23. 20:04
|
* @desc
|
*/
|
public class HundredWishActivityViewModel extends BaseViewModel<DataRepository> {
|
private MutableLiveData<List<HundredWishBean>> dataListLiveData;
|
|
public HundredWishActivityViewModel(@NonNull Application application) {
|
super(application);
|
}
|
|
@Override
|
protected DataRepository initModel() {
|
return DataRepository.getInstance();
|
}
|
|
public MutableLiveData<List<HundredWishBean>> getDataListLiveData() {
|
if (dataListLiveData == null) {
|
dataListLiveData = new MutableLiveData<>();
|
}
|
return dataListLiveData;
|
}
|
|
public void setDataListLiveData(MutableLiveData<List<HundredWishBean>> dataListLiveData) {
|
this.dataListLiveData = dataListLiveData;
|
}
|
|
public void getHundredWish() {
|
List<HundredWishBean> beans = new ArrayList<>();
|
for (int i = 0; i < 10; i++) {
|
HundredWishBean bean = new HundredWishBean();
|
bean.setTitle("标题");
|
bean.setCreateTime("2020-01-01");
|
bean.setReason("始于何因");
|
bean.setBeneficiary("受惠人");
|
bean.setHeir("继承人");
|
bean.setDifficulty("实现难度");
|
bean.setIsEffective(1);
|
bean.setRemark("备注");
|
beans.add(bean);
|
}
|
HundredWishBean bean = new HundredWishBean();
|
bean.setTitle("标题aaaaaaaaaaaaaa");
|
bean.setCreateTime("2020-01-01");
|
bean.setReason("始于何因");
|
bean.setBeneficiary("受惠人");
|
bean.setHeir("继承人");
|
bean.setDifficulty("实现难度");
|
bean.setIsEffective(1);
|
bean.setRemark("备注");
|
beans.add(bean);
|
dataListLiveData.setValue(beans);
|
}
|
}
|