package com.live.mylivewallpaper.viewmode;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.ViewModel;
import androidx.paging.Pager;
import androidx.paging.PagingConfig;
import androidx.paging.PagingData;
import androidx.paging.PagingLiveData;

import com.live.mylivewallpaper.data.ResultData;
import com.live.mylivewallpaper.paging.MyPagingSource;


public class VmMainFragment extends ViewModel {

    public LiveData<PagingData<ResultData>> getPagingData(int wallpaperType) {

        return PagingLiveData.getLiveData(new Pager<>(
                new PagingConfig(10), // 每页加载 20 条数据
                () -> new MyPagingSource(wallpaperType)
        ));
    }

}
