Skip to content

Instantly share code, notes, and snippets.

@bltuckerdevblog
Created May 27, 2018 17:16
Show Gist options
  • Save bltuckerdevblog/b80839967c2f06f8809c75bd6d19f11c to your computer and use it in GitHub Desktop.
Save bltuckerdevblog/b80839967c2f06f8809c75bd6d19f11c to your computer and use it in GitHub Desktop.
class TeamsViewModel @Inject
constructor(private val teamDao: TeamDao) : ViewModel(){
val liveTeamData: LiveData<PagedList<Team>>
init {
val teamsByNameDataSourceFactory = teamDao.loadTeamsByName()
val pagedListConfig = PagedList.Config.Builder()
.setEnablePlaceholders(true)
.setInitialLoadSizeHint(10)
.setPageSize(10)
.build()
liveTeamData = LivePagedListBuilder(teamsByNameDataSourceFactory, pagedListConfig).build()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment