-
- All Implemented Interfaces:
-
com.airbnb.epoxy.ModelCollector,com.airbnb.epoxy.stickyheader.StickyHeaderCallbacks
public abstract class PagedListEpoxyController<T extends Object> extends EpoxyControllerAn EpoxyController that can work with a PagedList.
Internally, it caches the model for each item in the PagedList. You should override buildItemModel method to build the model for the given item. Since PagedList might include
nullitems if placeholders are enabled, this method needs to handlenullvalues in the list.By default, the model for each item is added to the model list. To change this behavior (to filter items or inject extra items), you can override addModels function and manually add built models.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classPagedListEpoxyController.Companion
-
Constructor Summary
Constructors Constructor Description PagedListEpoxyController(Handler modelBuildingHandler, Handler diffingHandler, DiffUtil.ItemCallback<T> itemDiffCallback)
-
Method Summary
Modifier and Type Method Description UnitaddModels(List<EpoxyModel<?>> models)This function adds all built models to the adapter. abstract EpoxyModel<?>buildItemModel(Integer currentPosition, T item)Builds the model for a given item. final UnitsubmitList(PagedList<T> newList)Submit a new paged list. final UnitrequestForcedModelBuild()Requests a model build that will run for every model, including the ones created for the paged list. -
Methods inherited from class com.airbnb.epoxy.paging.PagedListEpoxyController
add, add, add, addAfterInterceptorCallback, addCurrentlyStagedModelIfExists, addInterceptor, addInternal, addModelBuildListener, cancelPendingModelBuild, clearModelFromStaging, getAdapter, getFirstIndexOfModelInBuildingList, getModelCountBuiltSoFar, getSpanCount, getSpanSizeLookup, hasPendingModelBuild, isBuildingModels, isDebugLoggingEnabled, isDuplicateFilteringEnabled, isModelAddedMultipleTimes, isMultiSpan, isStickyHeader, moveModel, notifyModelChanged, onAttachedToRecyclerView, onAttachedToRecyclerViewInternal, onDetachedFromRecyclerView, onDetachedFromRecyclerViewInternal, onExceptionSwallowed, onModelUnbound, onRestoreInstanceState, onSaveInstanceState, onViewAttachedToWindow, onViewDetachedFromWindow, removeInterceptor, removeModelBuildListener, requestDelayedModelBuild, requestModelBuild, setDebugLoggingEnabled, setFilterDuplicates, setSpanCount, setStagedModel, setupStickyHeaderView, teardownStickyHeaderView -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
PagedListEpoxyController
PagedListEpoxyController(Handler modelBuildingHandler, Handler diffingHandler, DiffUtil.ItemCallback<T> itemDiffCallback)
-
-
Method Detail
-
addModels
Unit addModels(List<EpoxyModel<?>> models)
This function adds all built models to the adapter. You can override this method to add extra items into the model list or remove some.
-
buildItemModel
abstract EpoxyModel<?> buildItemModel(Integer currentPosition, T item)
Builds the model for a given item. This must return a single model for each item. If you want to inject headers etc, you can override addModels function.
If the
itemisnull, you should provide the placeholder. If your PagedList is configured without placeholders, you don't need to handle thenullcase.
-
submitList
final Unit submitList(PagedList<T> newList)
Submit a new paged list.
A diff will be calculated between this list and the previous list so you may still get calls to buildItemModel with items from the previous list.
-
requestForcedModelBuild
final Unit requestForcedModelBuild()
Requests a model build that will run for every model, including the ones created for the paged list.
Clears the current model cache to make sure that happens.
-
-
-
-