Created
September 13, 2020 23:15
-
-
Save enginebai/26bc939a5f47834b1f43611a535f8f6a to your computer and use it in GitHub Desktop.
MovieHunt blog part3 repo
This file contains hidden or 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
interface MovieRepo { | |
fun fetchMovieList(category: MovieCategory, pageSize: Int = DEFAULT_PAGE_SIZE): Observable<PagedList<MovieModel>> | |
} | |
class MovieRepoImpl : MovieRepo, KoinComponent { | |
override fun fetchMovieList( | |
category: MovieCategory, | |
pageSize: Int | |
): Observable<PagedList<MovieModel>> { | |
val dataSourceFactory = MovieListDataSourceFactory(category) | |
val pagedListConfig = PagedList.Config.Builder() | |
.setPageSize(DEFAULT_PAGE_SIZE) | |
.setEnablePlaceholders(false) | |
.build() | |
return RxPagedListBuilder(dataSourceFactory, pagedListConfig) | |
.setFetchScheduler(Schedulers.io()) | |
.buildObservable() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment