Linjiajia
2023-04-28 15cd434674051e5d29215b47862686c773625fd4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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.PrivacyBean;
import com.application.zhangshi_app_android.data.DataRepository;
 
import java.util.ArrayList;
import java.util.List;
 
/**
 * @author Ljj
 * @date 2023.04.28. 20:30
 * @desc
 */
public class PrivacyActivityViewModel extends BaseViewModel<DataRepository> {
    private MutableLiveData<List<PrivacyBean>> dataListLiveData;
 
    public PrivacyActivityViewModel(@NonNull Application application) {
        super(application);
    }
 
    @Override
    protected DataRepository initModel() {
        return DataRepository.getInstance();
    }
 
    public MutableLiveData<List<PrivacyBean>> getDataListLiveData() {
        if (dataListLiveData == null) {
            dataListLiveData = new MutableLiveData<>();
        }
        return dataListLiveData;
    }
 
    public void setDataListLiveData(MutableLiveData<List<PrivacyBean>> dataListLiveData) {
        this.dataListLiveData = dataListLiveData;
    }
 
    /**
     *  获取年度健康情况
     */
    public void getPrivacy() {
        List<PrivacyBean> beans =  new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            PrivacyBean bean = new PrivacyBean();
            bean.setType("QQ号");
            bean.setTime("2020-01-01");
            bean.setAccount("12345678");
            bean.setPassword("000000");
            bean.setEffectiveTime("2030-01-01");
            bean.setIsFace(0);
            bean.setIsFingerprint(0);
            bean.setIsPublic(1);
            bean.setLocation("————");
            bean.setRemark("我的QQ号");
            beans.add(bean);
        }
        dataListLiveData.setValue(beans);
    }
}