Created
April 25, 2021 10:29
-
-
Save varundwarkani/db6950736306bd1d1cc8d1d83b45554a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UpcomingMatchesDataSourceFactory extends DataSource.Factory<Integer, UpcomingMatch> { | |
private UpcomingMatchesRepository upcomingMatchesRepository; | |
private MutableLiveData<PageKeyedDataSource<Integer, UpcomingMatch>> pageKeyedDataSourceMutableLiveData = new MutableLiveData<>(); | |
public UpcomingMatchesDataSourceFactory(UpcomingMatchesRepository upcomingMatchesRepository) { | |
this.upcomingMatchesRepository = upcomingMatchesRepository; | |
} | |
@Override | |
public DataSource create() { | |
UpcomingMatchesDataSource upcomingMatchesDataSource = new UpcomingMatchesDataSource(upcomingMatchesRepository); | |
pageKeyedDataSourceMutableLiveData.postValue(upcomingMatchesDataSource); | |
return upcomingMatchesDataSource; | |
} | |
public MutableLiveData<PageKeyedDataSource<Integer, UpcomingMatch>> getPageKeyedDataSourceMutableLiveData() { | |
return pageKeyedDataSourceMutableLiveData; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment