-
- All Implemented Interfaces:
-
androidx.recyclerview.widget.ItemTouchHelper.ViewDropHandler,androidx.recyclerview.widget.RecyclerView.SmoothScroller.ScrollVectorProvider
public final class StickyHeaderLinearLayoutManager extends LinearLayoutManager
Adds sticky headers capabilities to your RecyclerView.Adapter. The adapter / controller must override StickyHeaderCallbacks.isStickyHeader to indicate which items are sticky.
Example usage:
class StickyHeaderController() : EpoxyController() { override fun isStickyHeader(position: Int) { // Write your logic to tell which item is sticky. } }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classStickyHeaderLinearLayoutManager.SavedStateSave / restore existing RecyclerView state and scrolling position and offset.
-
Field Summary
Fields Modifier and Type Field Description private final IntegermOrientationprivate final OrientationHelpermOrientationHelperprivate final BooleanmShouldReverseLayoutprivate final IntegermPendingScrollPositionprivate final IntegermPendingScrollPositionOffsetprivate final LinearLayoutManager.SavedStatemPendingSavedStateprivate final LinearLayoutManager.AnchorInfomAnchorInfoprivate final ChildHelpermChildHelperprivate final RecyclerViewmRecyclerViewprivate final ViewBoundsCheckmHorizontalBoundCheckprivate final ViewBoundsCheckmVerticalBoundCheckprivate final RecyclerView.SmoothScrollermSmoothScrollerprivate final BooleanmRequestedSimpleAnimationsprivate final BooleanmIsAttachedToWindowprivate final BooleanmAutoMeasureprivate final IntegermPrefetchMaxCountObservedprivate final BooleanmPrefetchMaxObservedInInitialPrefetch
-
Constructor Summary
Constructors Constructor Description StickyHeaderLinearLayoutManager(Context context, Integer orientation, Boolean reverseLayout)StickyHeaderLinearLayoutManager(Context context, Integer orientation)StickyHeaderLinearLayoutManager(Context context)
-
Method Summary
-
Methods inherited from class androidx.recyclerview.widget.LinearLayoutManager
addDisappearingView, addDisappearingView, addView, addView, assertInLayoutOrScroll, attachView, attachView, attachView, calculateItemDecorationsForChild, checkLayoutParams, detachAndScrapAttachedViews, detachAndScrapView, detachAndScrapViewAt, detachView, detachViewAt, dispatchAttachedToWindow, dispatchDetachedFromWindow, endAnimation, findContainingItemView, generateLayoutParams, generateLayoutParams, getBaseline, getBottomDecorationHeight, getChildAt, getChildCount, getClipToPadding, getColumnCountForAccessibility, getDecoratedBottom, getDecoratedBoundsWithMargins, getDecoratedLeft, getDecoratedMeasuredHeight, getDecoratedMeasuredWidth, getDecoratedRight, getDecoratedTop, getFocusedChild, getHeight, getHeightMode, getItemCount, getItemViewType, getLayoutDirection, getLeftDecorationWidth, getMinimumHeight, getMinimumWidth, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getPosition, getRightDecorationWidth, getRowCountForAccessibility, getSelectionModeForAccessibility, getTopDecorationHeight, getTransformedBoundingBox, getWidth, getWidthMode, hasFlexibleChildInBothOrientations, hasFocus, ignoreView, isAttachedToWindow, isFocused, isItemPrefetchEnabled, isLayoutHierarchical, isMeasurementCacheEnabled, isSmoothScrolling, isViewPartiallyVisible, layoutDecorated, layoutDecoratedWithMargins, measureChild, measureChildWithMargins, moveView, offsetChildrenHorizontal, offsetChildrenVertical, onAddFocusables, onDetachedFromWindow, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onInitializeAccessibilityNodeInfo, onInitializeAccessibilityNodeInfoForItem, onInitializeAccessibilityNodeInfoForItem, onInterceptFocusSearch, onItemsAdded, onItemsChanged, onItemsMoved, onItemsRemoved, onItemsUpdated, onItemsUpdated, onMeasure, onRequestChildFocus, onRequestChildFocus, onScrollStateChanged, onSmoothScrollerStopped, performAccessibilityAction, performAccessibilityAction, performAccessibilityActionForItem, performAccessibilityActionForItem, postOnAnimation, removeAllViews, removeAndRecycleAllViews, removeAndRecycleScrapInt, removeAndRecycleView, removeAndRecycleViewAt, removeCallbacks, removeDetachedView, removeView, removeViewAt, requestChildRectangleOnScreen, requestChildRectangleOnScreen, requestLayout, requestSimpleAnimationsInNextLayout, setAutoMeasureEnabled, setExactMeasureSpecsFrom, setItemPrefetchEnabled, setMeasureSpecs, setMeasuredDimension, setMeasuredDimension, setMeasuredDimensionFromChildren, setMeasurementCacheEnabled, setRecyclerView, shouldMeasureChild, shouldReMeasureChild, startSmoothScroll, stopIgnoringView, stopSmoothScroller -
Methods inherited from class com.airbnb.epoxy.stickyheader.StickyHeaderLinearLayoutManager
assertNotInLayoutOrScroll, calculateExtraLayoutSpace, canScrollHorizontally, canScrollVertically, collectAdjacentPrefetchPositions, collectInitialPrefetchPositions, collectPrefetchPositionsForLayoutState, convertFocusDirectionToLayoutDirection, createLayoutState, ensureLayoutState, fill, findFirstCompletelyVisibleItemPosition, findFirstVisibleChildClosestToEnd, findFirstVisibleChildClosestToStart, findFirstVisibleItemPosition, findLastCompletelyVisibleItemPosition, findLastVisibleItemPosition, findOnePartiallyOrCompletelyInvisibleChild, findOneVisibleChild, findReferenceChild, findViewByPosition, generateDefaultLayoutParams, getExtraLayoutSpace, getInitialPrefetchItemCount, getOrientation, getRecycleChildrenOnDetach, getReverseLayout, getStackFromEnd, isAutoMeasureEnabled, isLayoutRTL, isSmoothScrollbarEnabled, layoutChunk, onAnchorReady, onDetachedFromWindow, onInitializeAccessibilityEvent, onLayoutCompleted, prepareForDrop, resolveIsInfinite, scrollBy, setInitialPrefetchItemCount, setOrientation, setRecycleChildrenOnDetach, setReverseLayout, setSmoothScrollbarEnabled, setStackFromEnd, shouldMeasureTwice, smoothScrollToPosition, supportsPredictiveItemAnimations, validateChildOrder -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
StickyHeaderLinearLayoutManager
StickyHeaderLinearLayoutManager(Context context, Integer orientation, Boolean reverseLayout)
-
StickyHeaderLinearLayoutManager
StickyHeaderLinearLayoutManager(Context context, Integer orientation)
-
StickyHeaderLinearLayoutManager
StickyHeaderLinearLayoutManager(Context context)
-
-
Method Detail
-
onAttachedToWindow
Unit onAttachedToWindow(RecyclerView recyclerView)
-
onAdapterChanged
Unit onAdapterChanged(RecyclerView.Adapter<?> oldAdapter, RecyclerView.Adapter<?> newAdapter)
-
onSaveInstanceState
Parcelable onSaveInstanceState()
-
onRestoreInstanceState
Unit onRestoreInstanceState(Parcelable state)
-
scrollVerticallyBy
Integer scrollVerticallyBy(Integer dy, RecyclerView.Recycler recycler, RecyclerView.State state)
-
scrollHorizontallyBy
Integer scrollHorizontallyBy(Integer dx, RecyclerView.Recycler recycler, RecyclerView.State state)
-
onLayoutChildren
Unit onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state)
-
scrollToPosition
Unit scrollToPosition(Integer position)
-
scrollToPositionWithOffset
Unit scrollToPositionWithOffset(Integer position, Integer offset)
-
computeVerticalScrollExtent
Integer computeVerticalScrollExtent(RecyclerView.State state)
-
computeVerticalScrollOffset
Integer computeVerticalScrollOffset(RecyclerView.State state)
-
computeVerticalScrollRange
Integer computeVerticalScrollRange(RecyclerView.State state)
-
computeHorizontalScrollExtent
Integer computeHorizontalScrollExtent(RecyclerView.State state)
-
computeHorizontalScrollOffset
Integer computeHorizontalScrollOffset(RecyclerView.State state)
-
computeHorizontalScrollRange
Integer computeHorizontalScrollRange(RecyclerView.State state)
-
computeScrollVectorForPosition
PointF computeScrollVectorForPosition(Integer targetPosition)
-
onFocusSearchFailed
View onFocusSearchFailed(View focused, Integer focusDirection, RecyclerView.Recycler recycler, RecyclerView.State state)
-
setStickyHeaderTranslationY
final Unit setStickyHeaderTranslationY(Float translationY)
Offsets the vertical location of the sticky header relative to the its default position.
-
setStickyHeaderTranslationX
final Unit setStickyHeaderTranslationX(Float translationX)
Offsets the horizontal location of the sticky header relative to the its default position.
-
isStickyHeader
final Boolean isStickyHeader(View view)
Returns true if
viewis the current sticky header.
-
-
-
-