LazyCollectionController

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.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Tells if the refresh indicator is currently shown or not

Link copied to clipboard

Retrieve a reference to the RecyclerView. This should be avoided if possible, but may be necessary e.g. for custom animations.

Link copied to clipboard

A reference to the SnapHelper that is currently attached to the RecyclerView. If this LazyCollection isn't mounted or doesn't have an associated SnapHelper, returns null.

Functions

Link copied to clipboard
fun scrollBy(@Px dx: Int, @Px dy: Int)

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

Link copied to clipboard
fun scrollToId(id: Any, @Px offset: Int = 0)

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 scrollToIndex(index: Int, @Px offset: Int = 0)

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 setRecyclerUpdate(listener: (RecyclerView?) -> Unit)

Request a call back when a RecyclerView is bound or unbound.

Link copied to clipboard
fun setRefreshing(isRefreshing: Boolean)

Toggle the refresh indicator based off a boolean. It is not necessary to call this within the LazyCollection's onPullToRefresh callback as it will be triggered automatically.

Link copied to clipboard
fun smoothScrollBy(@Px dx: Int, @Px dy: Int)

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

Link copied to clipboard
fun smoothScrollToId(id: Any, @Px offset: Int = 0, 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 smoothScrollToIndex(index: Int, @Px offset: Int = 0, 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.