package com.hainaos.vc.activity.pic;

import androidx.lifecycle.MutableLiveData;

import com.hainaos.vc.base.mvvm.BaseViewModel;
import com.hainaos.vc.bean.PhotoInfo;
import com.hainaos.vc.databinding.ActivityGalleryBinding;
import com.hainaos.vc.network.NetInterfaceManager;
import com.trello.rxlifecycle4.android.ActivityEvent;

import java.util.ArrayList;

public class GalleryViewModel extends BaseViewModel<ActivityGalleryBinding, ActivityEvent> {

    @Override
    public ActivityGalleryBinding getVDBinding() {
        return binding;
    }

    @Override
    public void onDestroy() {

    }

    public MutableLiveData<ArrayList<PhotoInfo>> mPhotoInfosData = new MutableLiveData<>();

    public MutableLiveData<Boolean> mCompleteData = new MutableLiveData<>();

    public void getHomePhoto() {
        NetInterfaceManager.getInstance().getHomePhoto(true, getLifecycle(), new NetInterfaceManager.onPhotoCallback() {
            @Override
            public void setPhotoList(ArrayList<PhotoInfo> photoList) {
                mPhotoInfosData.setValue(photoList);
            }

            @Override
            public void onComplete() {
                mCompleteData.setValue(true);
            }
        });
    }
}
