LazyListScope

class LazyListScope(val context: ComponentContext) : ResourcesScope

Constructors

Link copied to clipboard
fun LazyListScope(context: ComponentContext)

Functions

Link copied to clipboard
fun child(component: Component?, id: Any? = null, isSticky: Boolean = false, onNearViewport: OnNearCallback? = null)

Add a child Component to the Lazy Collection.

fun child(id: Any? = null, isSticky: Boolean = false, onNearViewport: OnNearCallback? = null, deps: Array<Any?>, componentFunction: ComponentCreationScope.() -> Component?)

Add a child Component created by the provided componentFunction function to the Lazy Collection.

Link copied to clipboard
fun <T> children(items: Iterable<T>, id: (T) -> Any, componentFunction: ComponentCreationScope.(T) -> Component?)
fun <T> children(items: Iterable<T>, id: (T) -> Any, deps: (T) -> Array<Any?>, componentFunction: ComponentCreationScope.(T) -> Component?)

Add a list of children generated by applying componentFunction to each item in a list of models.

Link copied to clipboard
open fun Dimen.toPixels(): Int

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val context: ComponentContext
Link copied to clipboard
open val resourceResolver: ResourceResolver

Extensions

Link copied to clipboard
inline fun ResourcesScope.Border(edgeAll: BorderEdge? = null, edgeHorizontal: BorderEdge? = null, edgeVertical: BorderEdge? = null, edgeStart: BorderEdge? = null, edgeEnd: BorderEdge? = null, edgeTop: BorderEdge? = null, edgeBottom: BorderEdge? = null, edgeLeft: BorderEdge? = null, edgeRight: BorderEdge? = null, radius: BorderRadius? = null, effect: BorderEffect? = null): Border

Creates a border style to be applied to a component

Link copied to clipboard
inline fun ResourcesScope.Card(style: Style? = null, cardBackgroundColor: Int = Color.WHITE, cornerRadius: Dimen = 2.dp, elevation: Dimen = 2.dp, clippingColor: Int = Integer.MIN_VALUE, shadowStartColor: Int = 922746880, shadowEndColor: Int = 50331648, shadowBottomOverride: Dimen? = null, disableClipTopLeft: Boolean = false, disableClipTopRight: Boolean = false, disableClipBottomLeft: Boolean = false, disableClipBottomRight: Boolean = false, transparencyEnabled: Boolean = false, child: ResourcesScope.() -> Component): Card

Builder function for creating CardSpec components.

Link copied to clipboard
inline fun ResourcesScope.HorizontalScroll(initialScrollPosition: Dimen? = null, scrollbarEnabled: Boolean = true, fillViewport: Boolean = false, eventsController: HorizontalScrollEventsController? = null, noinline onScrollChange: (View, scrollX: Int, oldScrollX: Int) -> Unit? = null, child: ResourcesScope.() -> Component): HorizontalScroll

Builder function for creating HorizontalScrollSpec components.

Link copied to clipboard
inline fun ResourcesScope.Image(drawable: Drawable, style: Style? = null, scaleType: ImageView.ScaleType = ScaleType.FIT_CENTER): Image

Builder function for creating ImageSpec components.

Link copied to clipboard
inline fun ResourcesScope.LazyGrid(orientation: Int = RecyclerView.VERTICAL, snapMode: Int = SnapUtil.SNAP_NONE, reverse: Boolean = false, columns: Int = 2, itemAnimator: RecyclerView.ItemAnimator? = null, 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, 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: (c: ComponentContext) -> Unit? = 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, isReconciliationEnabled: Boolean = false, childEquivalenceIncludesCommonProps: Boolean = true, overlayRenderCount: Boolean = false, alwaysDetectDuplicates: Boolean = false, noinline 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, reverse: Boolean = false, crossAxisWrapMode: CrossAxisWrapMode = CrossAxisWrapMode.NoWrap, mainAxisWrapContent: Boolean = false, itemAnimator: RecyclerView.ItemAnimator? = null, 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, 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: (c: ComponentContext) -> Unit? = 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, isReconciliationEnabled: Boolean = false, childEquivalenceIncludesCommonProps: Boolean = true, overlayRenderCount: Boolean = false, alwaysDetectDuplicates: Boolean = false, noinline 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? = null, 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, 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: (c: ComponentContext) -> Unit? = 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, isReconciliationEnabled: Boolean = false, childEquivalenceIncludesCommonProps: Boolean = true, overlayRenderCount: Boolean = false, alwaysDetectDuplicates: Boolean = false, noinline 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
inline fun ResourcesScope.Progress(color: Int? = null, style: Style? = null, indeterminateDrawable: Drawable? = null): Progress

Builder function for creating ProgressSpec components.

Link copied to clipboard
inline fun ResourcesScope.RecyclerCollectionComponent(section: Section, recyclerConfiguration: RecyclerConfiguration = RecyclerCollectionComponentSpec.recyclerConfiguration, itemAnimator: RecyclerView.ItemAnimator? = RecyclerCollectionComponentSpec.itemAnimator, itemDecoration: RecyclerView.ItemDecoration? = null, canMeasureRecycler: Boolean = false, loadingComponent: Component? = null, emptyComponent: Component? = null, errorComponent: Component? = null, recyclerViewClipToPadding: Boolean = RecyclerCollectionComponentSpec.clipToPadding, recyclerViewClipChildren: Boolean = RecyclerCollectionComponentSpec.clipChildren, recyclerViewStartPadding: Dimen? = null, recyclerViewEndPadding: Dimen? = null, recyclerViewTopPadding: Dimen? = null, recyclerViewBottomPadding: Dimen? = null, disablePTR: Boolean = false, nestedScrollingEnabled: Boolean = RecyclerCollectionComponentSpec.nestedScrollingEnabled, scrollBarStyle: Int = RecyclerCollectionComponentSpec.scrollBarStyle, recyclerViewId: Int = RecyclerCollectionComponentSpec.recyclerViewId, overScrollMode: Int = RecyclerCollectionComponentSpec.overScrollMode, refreshProgressBarColor: Int = RecyclerCollectionComponentSpec.refreshProgressBarColor, touchInterceptor: LithoRecyclerView.TouchInterceptor? = null, itemTouchListener: RecyclerView.OnItemTouchListener? = null, eventsController: RecyclerCollectionEventsController? = null, sectionTreeTag: String? = null, startupLogger: LithoStartupLogger? = null, stickyHeaderControllerFactory: StickyHeaderControllerFactory? = null, sectionsViewLogger: SectionsRecyclerView.SectionsRecyclerViewLogger? = null, handle: Handle? = null, style: Style? = null): RecyclerCollectionComponent

Kotlin wrapper for the Component generated by RecyclerCollectionComponentSpec.

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.

Link copied to clipboard
inline fun ResourcesScope.SolidColor(color: Int, style: Style? = null): SolidColor

Builder function for creating SolidColorSpec components.

Link copied to clipboard
inline fun ResourcesScope.Spinner(options: List<String>, selectedOption: String, @LayoutRes itemLayout: Int = android.R.layout.simple_dropdown_item_1line, selectedTextSize: Dimen = 16.sp, selectedTextColor: Int = 0xDE000000.toInt(), caret: Drawable? = null, noinline onItemSelected: (ItemSelectedEvent) -> Unit): Spinner

Builder function for creating SpinnerSpec components.

Link copied to clipboard
inline fun ResourcesScope.Text(text: CharSequence?, style: Style? = null, textColor: Int = Color.BLACK, textSize: Dimen = 14.sp, textStyle: Int = NORMAL, typeface: Typeface? = DEFAULT, shadowColor: Int = Color.GRAY, shadowRadius: Dimen = 0.dp, alignment: TextAlignment = TextAlignment.TEXT_START, breakStrategy: Int = 0, verticalGravity: VerticalGravity = VerticalGravity.TOP, isSingleLine: Boolean = false, ellipsize: TextUtils.TruncateAt? = null, lineSpacingMultiplier: Float = 1.0f, lineHeight: Dimen? = null, extraSpacing: Dimen? = null, letterSpacing: Float = 0.0f, minLines: Int = 0, maxLines: Int = Int.MAX_VALUE, includeFontPadding: Boolean = true, accessibleClickableSpans: Boolean = false, clipToBounds: Boolean = true, handle: Handle? = null, customEllipsisText: CharSequence? = null, backgroundColor: Int? = null, highlightColor: Int? = null, textDirection: TextDirectionHeuristicCompat? = null, @AttrRes defStyleAttr: Int = 0, @StyleRes defStyleRes: Int = 0, dynamicTextColor: DynamicValue<Int>? = null, testKey: String? = null): Text

Temporary builder function for creating TextSpec components. In the future it will either be auto-generated or modified to have the final set of parameters.

Link copied to clipboard
inline fun ResourcesScope.TextInput(initialText: CharSequence, style: Style? = null, hint: CharSequence = "", textColor: Int = Color.BLACK, hintTextColor: Int = Color.LTGRAY, textSize: Dimen = 14.sp, typeface: Typeface = Typeface.DEFAULT, textAlignment: Int = View.TEXT_ALIGNMENT_GRAVITY, gravity: Int = Gravity.CENTER_VERTICAL or Gravity.START, editable: Boolean = true, multiline: Boolean = false, minLines: Int = 1, maxLines: Int = Int.MAX_VALUE, inputType: Int = EditorInfo.TYPE_CLASS_TEXT, imeOptions: Int = EditorInfo.IME_NULL, inputFilter: InputFilter? = null, noinline onTextChanged: (TextChangedEvent) -> Unit? = null, noinline onSelectionChanged: (SelectionChangedEvent) -> Unit? = null, handle: Handle? = null): TextInput

Builder function for creating TextInputSpec components.

Link copied to clipboard
inline fun ResourcesScope.VerticalScroll(initialScrollPosition: Dimen = 0.px, scrollbarEnabled: Boolean = false, scrollbarFadingEnabled: Boolean = true, verticalFadingEdgeEnabled: Boolean = false, nestedScrollingEnabled: Boolean = false, fadingEdgeLength: Dimen = 0.dp, fillViewport: Boolean = false, incrementalMountEnabled: Boolean = false, eventsController: VerticalScrollEventsController? = null, noinline onScrollChange: (NestedScrollView, scrollY: Int, oldScrollY: Int) -> Unit? = null, noinline onInterceptTouch: (NestedScrollView, event: MotionEvent) -> Boolean? = null, style: Style? = null, child: ResourcesScope.() -> Component): VerticalScroll

Builder function for creating VerticalScrollSpec components.