Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
MovieHunt blog part3. repo modified
interface MovieRepo {
fun fetchMovieList(category: MovieCategory, pageSize: Int = DEFAULT_PAGE_SIZE): Listing<MovieModel>
class MovieRepoImpl : MovieRepo, KoinComponent {
override fun fetchMovieList(
category: MovieCategory,
pageSize: Int
): Listing<MovieModel> {
val dataSourceFactory = MovieListDataSourceFactory(category)
val pagedListConfig = PagedList.Config.Builder()
val pagedList = RxPagedListBuilder(dataSourceFactory, pagedListConfig)
return Listing(
pagedList = pagedList,
refreshState = dataSourceFactory.initLoadState,
loadMoreState = dataSourceFactory.loadMoreState,
refresh = { dataSourceFactory.dataSource?.invalidate() }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment