Skip to content

Paging Support

Eli Hart edited this page Sep 26, 2018 · 4 revisions

Epoxy integrates with the Android Paging Library to load large data sets efficiently.

Usage

Paging support is a separate Epoxy module that you must add with

dependencies {
  implementation 'com.airbnb.android:epoxy-paging:2.18.0' // Use latest epoxy version here
}

To use it, extend PagedListEpoxyController<T> and implement fun buildItemModel(currentPosition: Int, item: T?): EpoxyModel<*>. The T type parameter represents the type of the list that is being used. Then, call submitList to set aPagedList (from the Paging Library) as a data source.

The PagedListEpoxyController listens to the PagedList, and intelligently builds models as more data is loaded, or rebuilds models as data changes.

Just like a normal EpoxyController you can also mix in models of other types (like headers or footers), and request model builds whenever you need.