Package-level declarations

Types

Link copied to clipboard
data class CollectionChild(val id: Any, val component: Component? = null, val componentFunction: () -> Component?? = null, val isSticky: Boolean = false, val isFullSpan: Boolean = false, val spanSize: Int? = null, val parentWidthPercent: Float = -1f, val parentHeightPercent: Float = -1f, val deps: Array<Any?>? = null, val customAttributes: Map<String, Any?>? = null, val onNearViewport: OnNearCallback? = null)
Link copied to clipboard
class CollectionDiffCallback<T>(previousData: List<T>?, nextData: List<T>?, sameItemComparator: (previousItem: T, nextItem: T) -> Boolean? = null, sameContentComparator: (previousItem: T, nextItem: T) -> Boolean? = null) : DiffUtil.Callback

A DiffUtil.Callback that compares two lists of items and returns whether two items are the same.

Link copied to clipboard
Link copied to clipboard
abstract class CollectionLayout(componentContext: ComponentContext, orientation: Int, reverse: Boolean, rangeRatio: Float? = null, estimatedViewportCount: Int? = null, useBackgroundChangeSets: Boolean = false, isIncrementalMountEnabled: Boolean = componentContext.lithoConfiguration.componentsConfig.incrementalMountEnabled, mainAxisWrapContent: Boolean = false, crossAxisWrapMode: CrossAxisWrapMode = CrossAxisWrapMode.NoWrap, preAllocationHandler: PreAllocationHandler?, isCircular: Boolean, enableStableIds: Boolean)

Provide layout configuration options to a Collection

Link copied to clipboard
class CollectionRecyclerComponent(children: List<CollectionChild>, componentRenderer: (index: Int, model: CollectionChild) -> RenderInfo, contentComparator: (previousItem: CollectionChild, nextItem: CollectionChild) -> Boolean, idComparator: (previousItem: CollectionChild, nextItem: CollectionChild) -> Boolean, recyclerConfiguration: RecyclerConfiguration, clipChildren: Boolean = true, clipToPadding: Boolean = true, bottomPadding: Int = 0, endPadding: Int = 0, fadingEdgeLength: Int = 0, horizontalFadingEdgeEnabled: Boolean = false, isBottomFadingEnabled: Boolean = true, isLeftFadingEnabled: Boolean = true, isRightFadingEnabled: Boolean = true, isTopFadingEnabled: Boolean = true, itemAnimator: RecyclerView.ItemAnimator? = null, itemDecoration: RecyclerView.ItemDecoration? = null, itemTouchListener: RecyclerView.OnItemTouchListener? = null, lazyCollectionController: LazyCollectionController? = null, nestedScrollingEnabled: Boolean = true, onAfterLayoutListener: LithoRecyclerView.OnAfterLayoutListener? = null, onBeforeLayoutListener: LithoRecyclerView.OnBeforeLayoutListener? = null, onDataBound: OnDataBound? = null, onDataRendered: OnDataRendered? = null, onPullToRefresh: () -> Unit? = null, onScrollListeners: List<RecyclerView.OnScrollListener?>? = null, onViewportChanged: OnViewportChanged? = null, overScrollMode: Int = View.OVER_SCROLL_ALWAYS, pullToRefreshEnabled: Boolean = false, recyclerViewId: Int = View.NO_ID, refreshProgressBarBackgroundColor: Int? = null, refreshProgressBarColor: Int = Color.BLACK, scrollBarStyle: Int = View.SCROLLBARS_INSIDE_OVERLAY, sectionsViewLogger: SectionsRecyclerView.SectionsRecyclerViewLogger? = null, shouldExcludeFromIncrementalMount: Boolean = false, startPadding: Int = 0, startupLogger: LithoStartupLogger? = null, style: Style? = null, topPadding: Int = 0, touchInterceptor: LithoRecyclerView.TouchInterceptor? = null, verticalFadingEdgeEnabled: Boolean = false) : PrimitiveComponent

A component that renders a list of items using a RecyclerBinder.

Link copied to clipboard
Link copied to clipboard
class CollectionUpdateOperation<T>(val prevData: List<T>?, val nextData: List<T>?) : ListUpdateCallback

This class aims to generate the changeset between two lists of data and create the corresponding RenderInfo for later use.

Link copied to clipboard

A receiver for lambdas that create a component within a ContainerDsl. Prevents accidental calls to child()

Link copied to clipboard
class LazyCollection(layout: CollectionLayout, itemAnimator: RecyclerView.ItemAnimator?, itemDecoration: RecyclerView.ItemDecoration? = null, clipToPadding: Boolean? = null, clipChildren: Boolean? = null, startPadding: Dimen? = null, endPadding: Dimen? = null, topPadding: Dimen? = null, bottomPadding: Dimen? = null, nestedScrollingEnabled: Boolean? = null, scrollBarStyle: Int? = null, recyclerViewId: Int? = null, overScrollMode: Int? = null, refreshProgressBarBackgroundColor: Int? = null, refreshProgressBarColor: Int? = null, touchInterceptor: LithoRecyclerView.TouchInterceptor? = null, itemTouchListener: RecyclerView.OnItemTouchListener? = null, sectionTreeTag: String? = null, startupLogger: LithoStartupLogger? = null, style: Style? = null, onViewportChanged: OnViewportChanged? = null, handle: Handle? = null, onPullToRefresh: () -> Unit? = null, onNearEnd: OnNearCallback? = null, onScrollListener: RecyclerView.OnScrollListener? = null, onScrollListeners: List<RecyclerView.OnScrollListener?>? = null, lazyCollectionController: LazyCollectionController? = null, onDataRendered: OnDataRendered? = null, onDataBound: OnDataBound? = null, childEquivalenceIncludesCommonProps: Boolean = true, alwaysDetectDuplicates: Boolean = false, isLeftFadingEnabled: Boolean = true, isRightFadingEnabled: Boolean = true, isTopFadingEnabled: Boolean = true, isBottomFadingEnabled: Boolean = true, fadingEdgeLength: Dimen? = null, shouldExcludeFromIncrementalMount: Boolean = false, onBeforeLayout: LithoRecyclerView.OnBeforeLayoutListener? = null, onAfterLayout: LithoRecyclerView.OnAfterLayoutListener? = null, enableNewCollection: Boolean = false, lazyCollectionChildren: LazyCollectionChildren) : KComponent
Link copied to clipboard

A container for the children of a Lazy Collection. Manages the creation of ids, and callback registration.

Link copied to clipboard

A controller that can be set on a LazyCollection to trigger external events. Most calls should be made on the main thread e.g. within a Style.onClick { } callback.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
data class LinearSpacingItemDecoration(@Px val all: Int? = null, @Px val between: Int? = null, @Px val start: Int? = null, @Px val end: Int? = null) : RecyclerView.ItemDecoration
Link copied to clipboard
class OnNearCallback(val offset: Int = 0, val callback: () -> Unit)

A callback triggered when a LazyCollection is scrolled "near" to a specific position, as defined by being within offset items away.

Link copied to clipboard
sealed interface ScrollerDelegate
Link copied to clipboard
class SectionTreeScroller(sectionTree: SectionTree) : ScrollerDelegate

Functions

Link copied to clipboard
inline fun ResourcesScope.LazyGrid(orientation: Int = RecyclerView.VERTICAL, snapMode: Int = SnapUtil.SNAP_NONE, snapToStartOffset: Dimen = 0.dp, reverse: Boolean = false, columns: Int = 2, itemAnimator: RecyclerView.ItemAnimator? = CollectionRecyclerSpec.itemAnimator, itemDecoration: RecyclerView.ItemDecoration? = null, clipToPadding: Boolean? = null, clipChildren: Boolean? = null, startPadding: Dimen? = null, endPadding: Dimen? = null, topPadding: Dimen? = null, bottomPadding: Dimen? = null, nestedScrollingEnabled: Boolean? = null, scrollBarStyle: Int? = null, recyclerViewId: Int? = null, overScrollMode: Int? = null, refreshProgressBarBackgroundColor: Int? = null, refreshProgressBarColor: Int? = null, touchInterceptor: LithoRecyclerView.TouchInterceptor? = null, itemTouchListener: RecyclerView.OnItemTouchListener? = null, sectionTreeTag: String? = null, startupLogger: LithoStartupLogger? = null, style: Style? = null, noinline onViewportChanged: OnViewportChanged? = null, noinline onDataBound: OnDataBound? = null, handle: Handle? = null, noinline onPullToRefresh: () -> Unit? = null, onNearEnd: OnNearCallback? = null, onScrollListener: RecyclerView.OnScrollListener? = null, onScrollListeners: List<RecyclerView.OnScrollListener?>? = null, lazyCollectionController: LazyCollectionController? = null, noinline onDataRendered: OnDataRendered? = null, rangeRatio: Float? = null, estimatedViewportCount: Int? = null, useBackgroundChangeSets: Boolean = false, childEquivalenceIncludesCommonProps: Boolean = true, alwaysDetectDuplicates: Boolean = false, isLeftFadingEnabled: Boolean = true, isRightFadingEnabled: Boolean = true, isTopFadingEnabled: Boolean = true, isBottomFadingEnabled: Boolean = true, fadingEdgeLength: Dimen? = null, mainAxisWrapContent: Boolean = false, preAllocationHandler: PreAllocationHandler? = context.lithoConfiguration.componentsConfig.preAllocationHandler, shouldExcludeFromIncrementalMount: Boolean = false, enableStableIds: Boolean = context.lithoConfiguration.componentsConfig.useStableIdsInRecyclerBinder, gridLayoutInfoFactory: GridLayoutInfoFactory? = null, onBeforeLayout: LithoRecyclerView.OnBeforeLayoutListener? = null, onAfterLayout: LithoRecyclerView.OnAfterLayoutListener? = null, enableNewCollection: Boolean = false, crossinline init: LazyGridScope.() -> Unit): Component

A scrollable collection of components arranged in a grid

Link copied to clipboard
inline fun ResourcesScope.LazyList(orientation: Int = RecyclerView.VERTICAL, snapMode: Int = SnapUtil.SNAP_NONE, snapHelper: SnapHelper? = null, snapToStartOffset: Dimen = 0.dp, reverse: Boolean = false, crossAxisWrapMode: CrossAxisWrapMode = CrossAxisWrapMode.NoWrap, mainAxisWrapContent: Boolean = false, itemAnimator: RecyclerView.ItemAnimator? = CollectionRecyclerSpec.itemAnimator, itemDecoration: RecyclerView.ItemDecoration? = null, clipToPadding: Boolean? = null, clipChildren: Boolean? = null, startPadding: Dimen? = null, endPadding: Dimen? = null, topPadding: Dimen? = null, bottomPadding: Dimen? = null, nestedScrollingEnabled: Boolean? = null, scrollBarStyle: Int? = null, recyclerViewId: Int? = null, overScrollMode: Int? = null, refreshProgressBarBackgroundColor: Int? = null, refreshProgressBarColor: Int? = null, touchInterceptor: LithoRecyclerView.TouchInterceptor? = null, itemTouchListener: RecyclerView.OnItemTouchListener? = null, sectionTreeTag: String? = null, startupLogger: LithoStartupLogger? = null, style: Style? = null, noinline onViewportChanged: OnViewportChanged? = null, noinline onDataBound: OnDataBound? = null, handle: Handle? = null, noinline onPullToRefresh: () -> Unit? = null, onNearEnd: OnNearCallback? = null, onScrollListener: RecyclerView.OnScrollListener? = null, onScrollListeners: List<RecyclerView.OnScrollListener?>? = null, lazyCollectionController: LazyCollectionController? = null, noinline onDataRendered: OnDataRendered? = null, rangeRatio: Float? = null, useBackgroundChangeSets: Boolean = false, preAllocationHandler: PreAllocationHandler? = context.lithoConfiguration.componentsConfig.preAllocationHandler, childEquivalenceIncludesCommonProps: Boolean = true, alwaysDetectDuplicates: Boolean = false, isLeftFadingEnabled: Boolean = true, isRightFadingEnabled: Boolean = true, isTopFadingEnabled: Boolean = true, isBottomFadingEnabled: Boolean = true, fadingEdgeLength: Dimen? = null, shouldExcludeFromIncrementalMount: Boolean = false, isCircular: Boolean = false, enableStableIds: Boolean = context.lithoConfiguration.componentsConfig.useStableIdsInRecyclerBinder, enableNewCollection: Boolean = false, linearLayoutInfoFactory: LinearLayoutInfoFactory? = null, onBeforeLayout: LithoRecyclerView.OnBeforeLayoutListener? = null, onAfterLayout: LithoRecyclerView.OnAfterLayoutListener? = null, crossinline init: LazyListScope.() -> Unit): Component

A scrollable collection of components arranged linearly

Link copied to clipboard
inline fun ResourcesScope.LazyStaggeredGrid(orientation: Int = RecyclerView.VERTICAL, snapMode: Int = SnapUtil.SNAP_NONE, reverse: Boolean = false, spans: Int = 2, gapStrategy: Int = StaggeredGridLayoutManager.GAP_HANDLING_NONE, itemAnimator: RecyclerView.ItemAnimator? = CollectionRecyclerSpec.itemAnimator, itemDecoration: RecyclerView.ItemDecoration? = null, clipToPadding: Boolean? = null, clipChildren: Boolean? = null, startPadding: Dimen? = null, endPadding: Dimen? = null, topPadding: Dimen? = null, bottomPadding: Dimen? = null, nestedScrollingEnabled: Boolean? = null, scrollBarStyle: Int? = null, recyclerViewId: Int? = null, overScrollMode: Int? = null, refreshProgressBarBackgroundColor: Int? = null, refreshProgressBarColor: Int? = null, touchInterceptor: LithoRecyclerView.TouchInterceptor? = null, itemTouchListener: RecyclerView.OnItemTouchListener? = null, sectionTreeTag: String? = null, startupLogger: LithoStartupLogger? = null, style: Style? = null, noinline onViewportChanged: OnViewportChanged? = null, noinline onDataBound: OnDataBound? = null, handle: Handle? = null, noinline onPullToRefresh: () -> Unit? = null, onNearEnd: OnNearCallback? = null, onScrollListener: RecyclerView.OnScrollListener? = null, onScrollListeners: List<RecyclerView.OnScrollListener?>? = null, lazyCollectionController: LazyCollectionController? = null, noinline onDataRendered: OnDataRendered? = null, rangeRatio: Float? = null, useBackgroundChangeSets: Boolean = false, isIncrementalMountEnabled: Boolean = true, childEquivalenceIncludesCommonProps: Boolean = true, alwaysDetectDuplicates: Boolean = false, isLeftFadingEnabled: Boolean = true, isRightFadingEnabled: Boolean = true, isTopFadingEnabled: Boolean = true, isBottomFadingEnabled: Boolean = true, fadingEdgeLength: Dimen? = null, preAllocationHandler: PreAllocationHandler? = context.lithoConfiguration.componentsConfig.preAllocationHandler, shouldExcludeFromIncrementalMount: Boolean = false, staggeredGridlayoutInfoFactory: StaggeredGridLayoutInfoFactory? = null, enableStableIds: Boolean = context.lithoConfiguration.componentsConfig.useStableIdsInRecyclerBinder, onBeforeLayout: LithoRecyclerView.OnBeforeLayoutListener? = null, onAfterLayout: LithoRecyclerView.OnAfterLayoutListener? = null, enableNewCollection: Boolean = false, crossinline init: LazyGridScope.() -> Unit): Component

A scrollable collection of components arranged in a staggered grid

Link copied to clipboard
fun ResourcesScope.LinearSpacing(all: Dimen? = null, between: Dimen? = null, start: Dimen? = null, end: Dimen? = null): RecyclerView.ItemDecoration

An ItemDecoration to add spacing around list items in a Collection. It is intended for use with linear collections (which is the default layout, see CollectionLayouts.Linear), and wont work with grids or staggered grids.

Link copied to clipboard
fun ResourcesScope.scrollBy(controller: LazyCollectionController, dx: Dimen, dy: Dimen)

Scroll the LazyCollection by a given number of pixels. The Scroll is instant. For an animated scroll use smoothScrollBy.

Link copied to clipboard
fun ResourcesScope.scrollToId(controller: LazyCollectionController, id: Any, offset: Dimen = 0.px)

Scroll the LazyCollection so that the child with the given id is fully visible. For an animated scroll use smoothScrollToId.

Link copied to clipboard
fun ResourcesScope.scrollToIndex(controller: LazyCollectionController, index: Int, offset: Dimen = 0.px)

Scroll the LazyCollection so that the child at the given index is fully visible. For an animated scroll use smoothScrollToIndex.

Link copied to clipboard
fun ResourcesScope.smoothScrollBy(controller: LazyCollectionController, dx: Dimen, dy: Dimen)

Perform and animated scroll on the LazyCollection by a given number of pixels. For an instantaneous scroll use scrollBy.

Link copied to clipboard
fun ResourcesScope.smoothScrollToId(controller: LazyCollectionController, id: Any, offset: Dimen = 0.px, smoothScrollAlignmentType: SmoothScrollAlignmentType = SmoothScrollAlignmentType.DEFAULT)

Perform an animated scroll on the LazyCollection so that the child with the given id is fully visible. For an animated scroll use smoothScrollToId.

Link copied to clipboard
fun ResourcesScope.smoothScrollToIndex(controller: LazyCollectionController, index: Int, offset: Dimen = 0.px, smoothScrollAlignmentType: SmoothScrollAlignmentType = SmoothScrollAlignmentType.DEFAULT)

Perform an animated scroll on the LazyCollection so that the child at the given index is fully visible. For an instantaneous scroll use scrollToIndex.