Package 

Class EpoxyRecyclerView

  • All Implemented Interfaces:
    android.graphics.drawable.Drawable.Callback , android.view.KeyEvent.Callback , android.view.ViewManager , android.view.ViewParent , android.view.accessibility.AccessibilityEventSource , androidx.core.view.NestedScrollingChild , androidx.core.view.NestedScrollingChild2 , androidx.core.view.NestedScrollingChild3 , androidx.core.view.ScrollingView

    
    public class EpoxyRecyclerView
    extends RecyclerView
                        

    A RecyclerView implementation that makes for easier integration with Epoxy. The goal of this class is to reduce boilerplate in setting up a RecyclerView by applying common defaults. Additionally, several performance optimizations are made.

    Improvements in this class are:

    • A single view pool is automatically shared between all EpoxyRecyclerView instances in the same activity. This should increase view recycling potential and increase performance when nested RecyclerViews are used. See .initViewPool.

    • A layout manager is automatically added with assumed defaults. See createLayoutManager

    • Fixed size is enabled if this view's size is MATCH_PARENT

    • If a GridLayoutManager is used this will automatically sync the span count with the EpoxyController. See syncSpanCount

    • Helper methods like withModels, setModels, buildModelsWith make it simpler to set up simple RecyclerViews.

    • Set an EpoxyController and build models in one step - setControllerAndBuildModels or withModels

    • Support for automatic item spacing. See .setItemSpacingPx

    • Defaults for usage as a nested recyclerview are provided in Carousel.

    • setClipToPadding is set to false by default since that behavior is commonly desired in a scrolling list

    • Method Summary

      Modifier and Type Method Description
      final <T extends EpoxyModel<?>, U extends ViewMetadata, P extends PreloadRequestHolder> Unit addPreloader(Integer maxPreloadDistance, Function2<Context, RuntimeException, Unit> errorHandler, EpoxyModelPreloader<T, U, P> preloader, Function0<P> requestHolderFactory) Setup a preloader to fetch content for a model's view before it is bound.
      final Unit clearPreloaders() Clears all preloaders added with addPreloader
      final Unit setRemoveAdapterWhenDetachedFromWindow(Boolean removeAdapterWhenDetachedFromWindow) If set to true, any adapter set on this recyclerview will be removed when this view is detached from the window.
      final Unit setDelayMsWhenRemovingAdapterOnDetach(Integer delayMsWhenRemovingAdapterOnDetach) If .
      Boolean shouldShareViewPoolAcrossContext() To maximize view recycling by default we share the same view pool across all instances in the same Activity.
      Unit setLayoutParams(ViewGroup.LayoutParams params)
      Unit setLayoutManager(RecyclerView.LayoutManager layout)
      Unit requestLayout()
      final Unit setItemSpacingRes(@DimenRes() Integer itemSpacingRes)
      final Unit setItemSpacingDp(@Dimension(unit = 0) Integer dp)
      Unit setItemSpacingPx(@Px() Integer spacingPx) Set a pixel value to use as spacing between items.
      Unit setModels(List<EpoxyModel<?>> models) Set a list of EpoxyModel's to show in this RecyclerView.
      final Unit setController(EpoxyController controller) Set an EpoxyController to populate this RecyclerView.
      final Unit setControllerAndBuildModels(EpoxyController controller) Set an EpoxyController to populate this RecyclerView, and tell the controller to build models.
      final Unit withModels(Function1<EpoxyController, Unit> buildModels) The simplest way to add models to the RecyclerView without needing to create an EpoxyController.
      final Unit buildModelsWith(EpoxyRecyclerView.ModelBuilderCallback callback) Allows you to build models via a callback instead of needing to create a new EpoxyController class.
      final Unit requestModelBuild() Request that the currently set EpoxyController has its models rebuilt.
      Unit clear() Clear the currently set EpoxyController or Adapter as well as any models that are displayed.
      Unit setAdapter(RecyclerView.Adapter<?> adapter)
      Unit swapAdapter(RecyclerView.Adapter<?> adapter, Boolean removeAndRecycleExistingViews)
      Unit onAttachedToWindow()
      Unit onDetachedFromWindow()
      • Methods inherited from class android.view.ViewGroup

        addFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, addOnUnhandledKeyEventListener, animate, announceForAccessibility, autofill, autofill, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, cancelDragAndDrop, cancelLongPress, cancelPendingInputEvents, checkInputConnectionProxy, clearAnimation, clearViewTranslationCallback, computeScroll, computeSystemWindowInsets, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchGenericMotionEvent, dispatchNestedPrePerformAccessibilityAction, drawableHotspotChanged, findOnBackInvokedDispatcher, findViewById, findViewWithTag, fitSystemWindows, focusSearch, forceHasOverlappingRendering, forceLayout, generateDisplayHash, getAccessibilityDelegate, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityPaneTitle, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAlpha, getAnimation, getAnimationMatrix, getApplicationWindowToken, getAttributeResolutionStack, getAttributeSourceResourceMap, getAutofillHints, getAutofillId, getAutofillType, getAutofillValue, getBackground, getBackgroundTintBlendMode, getBackgroundTintList, getBackgroundTintMode, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentCaptureSession, getContentDescription, getContext, getContextMenuInfo, getDefaultFocusHighlightEnabled, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getExplicitStyle, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusable, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintBlendMode, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getHorizontalScrollbarThumbDrawable, getHorizontalScrollbarTrackDrawable, getId, getImportantForAccessibility, getImportantForAutofill, getImportantForContentCapture, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInSurface, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineAmbientShadowColor, getOutlineProvider, getOutlineSpotShadowColor, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getPointerIcon, getPreferKeepClearRects, getReceiveContentMimeTypes, getResources, getRevealOnFocusHint, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootSurfaceControl, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollCaptureHint, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getSourceLayoutResId, getStateDescription, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemGestureExclusionRects, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTooltipText, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchDelegate, getTouchables, getTransitionAlpha, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getUniqueDrawingId, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarThumbDrawable, getVerticalScrollbarTrackDrawable, getVerticalScrollbarWidth, getViewTranslationResponse, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowId, getWindowInsetsController, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasExplicitFocusable, hasFocusable, hasOnClickListeners, hasOnLongClickListeners, hasOverlappingRendering, hasPointerCapture, hasWindowFocus, invalidate, invalidate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityFocused, isAccessibilityHeading, isActivated, isAutoHandwritingEnabled, isClickable, isContextClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isForceDarkAllowed, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isImportantForAutofill, isImportantForContentCapture, isInEditMode, isInLayout, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isOpaque, isPaddingOffsetRequired, isPaddingRelative, isPivotSet, isPreferKeepClear, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScreenReaderFocusable, isScrollContainer, isScrollbarFadingEnabled, isSelected, isShowingLayoutBounds, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVisibleToUserForAutofill, keyboardNavigationClusterSearch, measure, offsetLeftAndRight, offsetTopAndBottom, onAnimationEnd, onAnimationStart, onApplyWindowInsets, onCancelPendingInputEvents, onCapturedPointerEvent, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateInputConnection, onCreateViewTranslationRequest, onCreateVirtualViewTranslationRequests, onDisplayHint, onDragEvent, onDrawForeground, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onOverScrolled, onPointerCaptureChange, onPopulateAccessibilityEvent, onProvideAutofillStructure, onProvideAutofillVirtualStructure, onProvideContentCaptureStructure, onProvideStructure, onProvideVirtualStructure, onReceiveContent, onRtlPropertiesChanged, onScreenStateChanged, onScrollCaptureSearch, onScrollChanged, onSetAlpha, onStartTemporaryDetach, onTrackballEvent, onViewTranslationResponse, onVirtualViewTranslationResponses, onVisibilityAggregated, onVisibilityChanged, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performAccessibilityAction, performClick, performContextClick, performContextClick, performHapticFeedback, performHapticFeedback, performLongClick, performLongClick, performReceiveContent, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, releasePointerCapture, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, removeOnUnhandledKeyEventListener, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocusFromTouch, requestPointerCapture, requestRectangleOnScreen, requestRectangleOnScreen, requestUnbufferedDispatch, requestUnbufferedDispatch, requireViewById, resetPivot, restoreHierarchyState, saveAttributeDataForStyleable, saveHierarchyState, scheduleDrawable, sendAccessibilityEvent, setAccessibilityDelegate, setAccessibilityHeading, setAccessibilityLiveRegion, setAccessibilityPaneTitle, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAllowClickWhenDisabled, setAlpha, setAnimation, setAnimationMatrix, setAutoHandwritingEnabled, setAutofillHints, setAutofillId, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintBlendMode, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentCaptureSession, setContentDescription, setContextClickable, setDefaultFocusHighlightEnabled, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusable, setFocusableInTouchMode, setFocusedByDefault, setForceDarkAllowed, setForeground, setForegroundGravity, setForegroundTintBlendMode, setForegroundTintList, setForegroundTintMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHorizontalScrollbarThumbDrawable, setHorizontalScrollbarTrackDrawable, setHovered, setId, setImportantForAccessibility, setImportantForAutofill, setImportantForContentCapture, setKeepScreenOn, setKeyboardNavigationCluster, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLeft, setLeftTopRightBottom, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnCapturedPointerListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnReceiveContentListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineAmbientShadowColor, setOutlineProvider, setOutlineSpotShadowColor, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPointerIcon, setPreferKeepClear, setPreferKeepClearRects, setPressed, setRenderEffect, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScreenReaderFocusable, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollBarSize, setScrollBarStyle, setScrollCaptureCallback, setScrollCaptureHint, setScrollContainer, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setScrollbarFadingEnabled, setSelected, setSoundEffectsEnabled, setStateDescription, setStateListAnimator, setSystemGestureExclusionRects, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTooltipText, setTop, setTouchDelegate, setTransitionAlpha, setTransitionName, setTransitionVisibility, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVerticalScrollbarThumbDrawable, setVerticalScrollbarTrackDrawable, setViewTranslationCallback, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, showContextMenu, showContextMenu, startActionMode, startActionMode, startAnimation, startDrag, startDragAndDrop, toString, transformMatrixToGlobal, transformMatrixToLocal, unscheduleDrawable, unscheduleDrawable, updateDragShadow, verifyDrawable, willNotCacheDrawing, willNotDraw
      • Methods inherited from class com.airbnb.epoxy.EpoxyRecyclerView

        absorbGlows, addFocusables, addItemDecoration, addItemDecoration, addOnChildAttachStateChangeListener, addOnItemTouchListener, addOnScrollListener, addRecyclerListener, animateAppearance, animateDisappearance, assertInLayoutOrScroll, assertNotInLayoutOrScroll, canReuseUpdatedViewHolder, checkLayoutParams, clearOldPositions, clearOnChildAttachStateChangeListeners, clearOnScrollListeners, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, considerReleasingGlowsOnScroll, consumeFlingInHorizontalStretch, consumeFlingInVerticalStretch, consumePendingUpdateOperations, defaultOnMeasure, dispatchChildAttached, dispatchChildDetached, dispatchLayout, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPreScroll, dispatchNestedPreScroll, dispatchNestedScroll, dispatchNestedScroll, dispatchNestedScroll, dispatchOnScrollStateChanged, dispatchOnScrolled, dispatchPendingImportantForAccessibilityChanges, dispatchPopulateAccessibilityEvent, dispatchRestoreInstanceState, dispatchSaveInstanceState, draw, drawChild, ensureBottomGlow, ensureLeftGlow, ensureRightGlow, ensureTopGlow, exceptionLabel, fillRemainingScrollValues, findChildViewUnder, findContainingItemView, findContainingViewHolder, findViewHolderForAdapterPosition, findViewHolderForItemId, findViewHolderForLayoutPosition, findViewHolderForPosition, findViewHolderForPosition, fling, focusSearch, generateDefaultLayoutParams, generateLayoutParams, generateLayoutParams, getAccessibilityClassName, getAdapter, getAdapterPositionInRecyclerView, getBaseline, getChangedHolderKey, getChildAdapterPosition, getChildDrawingOrder, getChildItemId, getChildLayoutPosition, getChildPosition, getChildViewHolder, getClipToPadding, getCompatAccessibilityDelegate, getDecoratedBoundsWithMargins, getEdgeEffectFactory, getItemAnimator, getItemDecorInsetsForChild, getItemDecorationAt, getItemDecorationCount, getLayoutManager, getMaxFlingVelocity, getMinFlingVelocity, getNanoTime, getOnFlingListener, getPreserveFocusAfterLayout, getRecycledViewPool, getScrollState, hasFixedSize, hasNestedScrollingParent, hasNestedScrollingParent, hasPendingAdapterUpdates, initAdapterManager, initFastScroller, invalidateGlows, invalidateItemDecorations, isAccessibilityEnabled, isAnimating, isAttachedToWindow, isComputingLayout, isLayoutFrozen, isLayoutSuppressed, isNestedScrollingEnabled, jumpToPositionForSmoothScroller, markItemDecorInsetsDirty, markKnownViewsInvalid, nestedScrollBy, offsetChildrenHorizontal, offsetChildrenVertical, offsetPositionRecordsForInsert, offsetPositionRecordsForMove, offsetPositionRecordsForRemove, onChildAttachedToWindow, onChildDetachedFromWindow, onDraw, onEnterLayoutOrScroll, onExitLayoutOrScroll, onExitLayoutOrScroll, onGenericMotionEvent, onInterceptTouchEvent, onLayout, onMeasure, onRequestFocusInDescendants, onRestoreInstanceState, onSaveInstanceState, onScrollStateChanged, onScrolled, onSizeChanged, onTouchEvent, postAnimationRunner, processDataSetCompletelyChanged, recordAnimationInfoIfBouncedHiddenView, removeAndRecycleViews, removeAnimatingView, removeDetachedView, removeItemDecoration, removeItemDecorationAt, removeOnChildAttachStateChangeListener, removeOnItemTouchListener, removeOnScrollListener, removeRecyclerListener, repositionShadowingViews, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, saveOldPositions, scrollBy, scrollByInternal, scrollStep, scrollTo, scrollToPosition, sendAccessibilityEventUnchecked, setAccessibilityDelegateCompat, setChildDrawingOrderCallback, setChildImportantForAccessibilityInternal, setClipToPadding, setEdgeEffectFactory, setHasFixedSize, setItemAnimator, setItemViewCacheSize, setLayoutFrozen, setLayoutTransition, setNestedScrollingEnabled, setOnFlingListener, setOnScrollListener, setPreserveFocusAfterLayout, setRecycledViewPool, setRecyclerListener, setScrollState, setScrollingTouchSlop, setViewCacheExtension, shouldDeferAccessibilityEvent, smoothScrollBy, smoothScrollBy, smoothScrollBy, smoothScrollBy, smoothScrollToPosition, startInterceptRequestLayout, startNestedScroll, startNestedScroll, stopInterceptRequestLayout, stopNestedScroll, stopNestedScroll, stopScroll, suppressLayout, viewRangeUpdate
      • Methods inherited from class androidx.recyclerview.widget.RecyclerView

        addChildrenForAccessibility, addExtraDataToAccessibilityNodeInfo, addKeyboardNavigationClusters, addStatesFromChildren, addTouchables, addView, addView, addView, addView, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, canAnimate, childDrawableStateChanged, childHasTransientStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchApplyWindowInsets, dispatchCapturedPointerEvent, dispatchConfigurationChanged, dispatchCreateViewTranslationRequest, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchFreezeSelfOnly, dispatchGenericFocusedEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPointerCaptureChanged, dispatchProvideAutofillStructure, dispatchProvideStructure, dispatchScrollCaptureSearch, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowInsetsAnimationEnd, dispatchWindowInsetsAnimationPrepare, dispatchWindowInsetsAnimationProgress, dispatchWindowInsetsAnimationStart, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, drawableStateChanged, endViewTransition, findFocus, findOnBackInvokedDispatcherForChild, findViewsWithText, focusableViewAvailable, gatherTransparentRegion, getChildAt, getChildCount, getChildDrawingOrder, getChildStaticTransformation, getChildVisibleRect, getClipChildren, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getNestedScrollAxes, getOverlay, getPersistentDrawingCache, getTouchscreenBlocksFocus, hasFocus, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, isMotionEventSplittingEnabled, isTransitionGroup, jumpDrawablesToCurrentState, layout, measureChild, measureChildWithMargins, measureChildren, notifySubtreeAccessibilityStateChanged, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onCreateDrawableState, onDescendantInvalidated, onInterceptHoverEvent, onNestedFling, onNestedPreFling, onNestedPrePerformAccessibilityAction, onNestedPreScroll, onNestedScroll, onNestedScrollAccepted, onRequestSendAccessibilityEvent, onResolvePointerIcon, onStartNestedScroll, onStopNestedScroll, onViewAdded, onViewRemoved, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestFocus, requestSendAccessibilityEvent, requestTransparentRegion, restoreDefaultFocus, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setStaticTransformationsEnabled, setTouchscreenBlocksFocus, setTransitionGroup, setWindowInsetsAnimationCallback, shouldDelayChildPressedState, showContextMenuForChild, showContextMenuForChild, startActionModeForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, updateViewLayout
      • Methods inherited from class java.lang.Object

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

      • addPreloader

         final <T extends EpoxyModel<?>, U extends ViewMetadata, P extends PreloadRequestHolder> Unit addPreloader(Integer maxPreloadDistance, Function2<Context, RuntimeException, Unit> errorHandler, EpoxyModelPreloader<T, U, P> preloader, Function0<P> requestHolderFactory)

        Setup a preloader to fetch content for a model's view before it is bound. This can be called multiple times if you would like to add separate preloaders for different models or content types.

        Preloaders are automatically attached and run, and are updated if the adapter changes.

        Parameters:
        maxPreloadDistance - How many items to prefetch ahead of the last bound item
        errorHandler - Called when the preloader encounters an exception.
        preloader - Describes how view content for the EpoxyModel should be preloaded
        requestHolderFactory - Should create and return a new PreloadRequestHolder each time it is invoked
      • setRemoveAdapterWhenDetachedFromWindow

         final Unit setRemoveAdapterWhenDetachedFromWindow(Boolean removeAdapterWhenDetachedFromWindow)

        If set to true, any adapter set on this recyclerview will be removed when this view is detached from the window. This is useful to prevent leaking a reference to this RecyclerView. This is useful in cases where the same adapter can be used across multiple views (views which can be destroyed and recreated), such as with fragments. In that case the adapter is not necessarily cleared from previous RecyclerViews, so the adapter will continue to hold a reference to those views and leak them. More details at https://github.com/airbnb/epoxy/wiki/Avoiding-Memory-Leaks#parent-view

        The default is true, but you can disable this if you don't want your adapter detached automatically.

        If the adapter is removed via this setting, it will be re-set on the RecyclerView if the RecyclerView is re-attached to the window at a later point.

      • setDelayMsWhenRemovingAdapterOnDetach

         final Unit setDelayMsWhenRemovingAdapterOnDetach(Integer delayMsWhenRemovingAdapterOnDetach)

        If .setRemoveAdapterWhenDetachedFromWindow is set to true, this is the delay in milliseconds between when .onDetachedFromWindow is called and when the adapter is actually removed.

        By default a delay of {@value #DEFAULT_ADAPTER_REMOVAL_DELAY_MS} ms is used so that view transitions can complete before the adapter is removed. Otherwise if the adapter is removed before transitions finish it can clear the screen and break the transition. A notable case is fragment transitions, in which the fragment view is detached from window before the transition ends.

      • shouldShareViewPoolAcrossContext

         Boolean shouldShareViewPoolAcrossContext()

        To maximize view recycling by default we share the same view pool across all instances in the same Activity. This behavior can be disabled by returning false here.

      • setItemSpacingPx

         Unit setItemSpacingPx(@Px() Integer spacingPx)

        Set a pixel value to use as spacing between items. If this is a positive number an item decoration will be added to space all items this far apart from each other. If the value is 0 or negative no extra spacing will be used, and any previous spacing will be removed.

        This only works if a LinearLayoutManager or GridLayoutManager is used with this RecyclerView.

        This can also be set via the app:itemSpacing styleable attribute.

      • setController

         final Unit setController(EpoxyController controller)

        Set an EpoxyController to populate this RecyclerView. This does not make the controller build its models, that must be done separately via requestModelBuild.

        Use this if you don't want requestModelBuild called automatically. Common cases are if you are using TypedEpoxyController (in which case you must call setData on the controller), or if you have not otherwise populated your controller's data yet.

        Otherwise if you want models built automatically for you use setControllerAndBuildModels

        The controller can be cleared with clear

      • withModels

         final Unit withModels(Function1<EpoxyController, Unit> buildModels)

        The simplest way to add models to the RecyclerView without needing to create an EpoxyController. This is intended for Kotlin usage, and has the EpoxyController as the lambda receiver so models can be added easily.

        Multiple calls to this will reuse the same underlying EpoxyController so views in the RecyclerView will be reused.

        The Java equivalent is buildModelsWith.

      • buildModelsWith

         final Unit buildModelsWith(EpoxyRecyclerView.ModelBuilderCallback callback)

        Allows you to build models via a callback instead of needing to create a new EpoxyController class. This is useful if your models are simple and you would like to simply declare them in your activity/fragment.

        Multiple calls to this will reuse the same underlying EpoxyController so views in the RecyclerView will be reused.

        Another useful pattern is having your Activity or Fragment implement ModelBuilderCallback.

        If you're using Kotlin, prefer withModels.

      • requestModelBuild

         final Unit requestModelBuild()

        Request that the currently set EpoxyController has its models rebuilt. You can use this to avoid saving your controller as a field.

        You cannot use this if your controller is a TypedEpoxyController or if you set models via setModels. In that case you must set data directly on the controller or set models again.

      • clear

         Unit clear()

        Clear the currently set EpoxyController or Adapter as well as any models that are displayed.

        Any pending requests to the EpoxyController to build models are canceled.

        Any existing child views are recycled to the view pool.