Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
MovieHunt blog part3. data source
class MovieDataSource : DataSource() {
private val api: MovieApiService by inject()
fun getMovieList(): PagedList<MovieListResponse> {
return api.fetchMovieList()
class MoviePagedListAdapter: PagedListAdapter() {
val pagedList: PagedList<MovieListResponse>
override fun onBindViewHolder(holder: Holder, position: Int) {
val movie = getItem(position)
... // bind data
class MovieListActivity() : BaseActivity() {
private val dataSource: MovieDataSource by inject()
private fun fetchList() {
val adapter = MoviePagedListAdapter
adapter.pagedList = dataSource.getMovieList()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment