Skip to content

Instantly share code, notes, and snippets.

@PhilippeBoisney
Last active February 12, 2019 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PhilippeBoisney/94ad9b34302990fb6dddf3ce932a8a9c to your computer and use it in GitHub Desktop.
Save PhilippeBoisney/94ad9b34302990fb6dddf3ce932a8a9c to your computer and use it in GitHub Desktop.
class UserDataSourceFactory(private val repository: UserRepository,
private var query: String = "",
private var sort: String = "",
private val scope: CoroutineScope): DataSource.Factory<Int, User>() {
val source = MutableLiveData<UserDataSource>()
override fun create(): DataSource<Int, User> {
val source = UserDataSource(repository, query, sort, scope)
this.source.postValue(source)
return source
}
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment