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.WebbackBean;
|
import com.application.zhangshi_app_android.data.DataRepository;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
public class WebbackDetailActivityViewModel extends BaseViewModel<DataRepository> {
|
|
private MutableLiveData<WebbackBean> beanLiveData;
|
private MutableLiveData<Boolean> typeLiveData;//true 编辑状态 false 展示状态
|
private final List<String> uploadFileList = new ArrayList<>();//需要上传的文件列表
|
public WebbackDetailActivityViewModel(@NonNull Application application) {
|
super(application);
|
}
|
|
@Override
|
protected DataRepository initModel() {
|
return DataRepository.getInstance();
|
}
|
|
|
public MutableLiveData<WebbackBean> getBeanLiveData() {
|
if (beanLiveData == null){
|
beanLiveData = new MutableLiveData<>();
|
}
|
if (beanLiveData.getValue() == null){
|
beanLiveData.setValue(new WebbackBean());
|
}
|
return beanLiveData;
|
}
|
|
public void setBeanLiveData(MutableLiveData<WebbackBean> beanLiveData) {
|
this.beanLiveData = beanLiveData;
|
}
|
|
public MutableLiveData<Boolean> getTypeLiveData() {
|
if (typeLiveData == null){
|
typeLiveData = new MutableLiveData<>();
|
}
|
return typeLiveData;
|
}
|
|
public void setTypeLiveData(MutableLiveData<Boolean> typeLiveData) {
|
this.typeLiveData = typeLiveData;
|
}
|
|
public List<String> getUploadFileList() {
|
return uploadFileList;
|
}
|
|
public void addUploadFile(String url) {
|
uploadFileList.add(url);
|
}
|
|
|
}
|