Package 

Class PagingEpoxyController

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

    @Deprecated() 
    public abstract class PagingEpoxyController<T>
    extends EpoxyController
                        

    An com.airbnb.epoxy.EpoxyController that meant for large lists of items.

    Normally buildModels should build a unique model to represent every item in the RecyclerView; however, that can be slow if there are more than a few hundred items. This controller will manage your list for you and only request models to be built for the items in the list around the current position on screen. As the user scrolls models will be rebuilt around the scroll position as needed.

    Additionally, this works with the Android Architecture component PagedList to load more items as needed.

    To use, simply call setList with either a normal Java List or an Android PagedList.

    buildModels will be called with the subset of items that should have models built for them.

    • Method Summary

      Modifier and Type Method Description
      PagedList<T> getPagedList()
      void setList(@Nullable() List<T> list)
      int totalListSize()
      void setConfig(@Nullable() PagedList.Config config) Set a Config value to specify how many models should be built at a time.
      List<T> getCurrentList()
      • Methods inherited from class com.airbnb.epoxy.EpoxyController

        add, addInterceptor, addModelBuildListener, cancelPendingModelBuild, getAdapter, getSpanCount, getSpanSizeLookup, hasPendingModelBuild, isDebugLoggingEnabled, isDuplicateFilteringEnabled, isMultiSpan, isStickyHeader, moveModel, notifyModelChanged, onRestoreInstanceState, onSaveInstanceState, removeInterceptor, removeModelBuildListener, requestDelayedModelBuild, requestModelBuild, setDebugLoggingEnabled, setFilterDuplicates, setGlobalDebugLoggingEnabled, setGlobalDuplicateFilteringDefault, setGlobalExceptionHandler, setSpanCount, setupStickyHeaderView, teardownStickyHeaderView
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • setConfig

         void setConfig(@Nullable() PagedList.Config config)

        Set a Config value to specify how many models should be built at a time.

        If not set, or set to null, the config value off of the currently set PagedList is used.

        If no PagedList is set, DEFAULT_CONFIG is used.

        initialLoadSizeHint dictates how many models are built on first load. Thisshould be several times the number of items shown on screen, and is generally equal to orlarger than pageSize.

        pageSize dictates how many models are built at a time after first load. Thisshould be several times the number of items shown on screen (roughly 10x, and at least 5x). Ifthis value is too small models will be rebuilt very often as the user scrolls, potentiallyhurting performance. In the worst case, if this value is too small, not enough models will becreated to fill the whole screen and the controller will enter an infinite loop of rebuildingmodels.

        prefetchDistance defines how far from the edge of built models the user mustscroll to trigger further model building. Should be significantly less than page size (roughly1/4), and more than the number of items shown on screen. If this value is too big models willbe rebuilt very often as the user scrolls, potentially hurting performance. If this number istoo small then the user may have to wait while models are rebuilt as they scroll.

        For example, if 5 items are shown on screen at once you might have a initialLoadSizeHint of 50,a pageSize of 50, and a prefetchDistance of 10.