Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Our ViewModel for Kitsu Screen
class KitsuViewModel(app: Application) : AndroidViewModel(app) {
private var allKitsuLiveData: LiveData<PagedList<KitsuItem>>? = null
val allKitsu: LiveData<PagedList<KitsuItem>>
get() {
if (null == allKitsuLiveData) {
allKitsuLiveData = KitsuMediaPagedListProvider.allKitsu().create(0,
return allKitsuLiveData ?: throw AssertionError("Check your threads ...")
fun setQueryFilter(queryFilter: String) {
allKitsuLiveData = null // invalidate
companion object {
private const val PAGED_LIST_PAGE_SIZE = 20
private const val PAGED_LIST_ENABLE_PLACEHOLDERS = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment