Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
MovieHunt blog part3. list data source factory
class MovieListDataSourceFactory(private val category: MovieCategory): DataSource.Factory<Int, MovieModel>() {
val initLoadState = BehaviorSubject.createDefault(NetworkState.IDLE)
val loadMoreState = BehaviorSubject.createDefault(NetworkState.IDLE)
var dataSource: MovieListDataSource? = null
override fun create(): DataSource<Int, MovieModel> {
dataSource = MovieListDataSource(category, initLoadState, loadMoreState)
return dataSource!!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment