Package 

Class PagedListEpoxyController

  • All Implemented Interfaces:
    com.airbnb.epoxy.ModelCollector , com.airbnb.epoxy.stickyheader.StickyHeaderCallbacks

    
    public abstract class PagedListEpoxyController<T extends Object>
    extends EpoxyController
                        

    An 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 null items if placeholders are enabled, this method needs to handle null values 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.

    • Method Summary

      Modifier and Type Method Description
      Unit addModels(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 Unit submitList(PagedList<T> newList) Submit a new paged list.
      final Unit requestForcedModelBuild() 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
    • 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 item is null, you should provide the placeholder. If your PagedList is configured without placeholders, you don't need to handle the null case.

      • 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.