LayoutInfo

An implementation of this interface will provide the RecyclerBinder with all the information about the RecyclerView layout.

Inheritors

Types

Link copied to clipboard
fun interface RenderInfoCollection
Link copied to clipboard
interface ViewportFiller

Interface that is responsible for filling the viewport of the list with initial layouts according to the LayoutManager. The goal here is to have the layouts that the RecyclerView will ask for when it comes onto the screen already computed, e.g. in the background, so that we don't drop frames on the main thread. NB: This class should try to respect the layout of views as they will appear in the RecyclerView.

Functions

Link copied to clipboard
abstract fun approximateRangeSize(firstMeasuredItemWidth: Int, firstMeasuredItemHeight: Int, recyclerMeasuredWidth: Int, recyclerMeasuredHeight: Int): Int

This is called when the RecyclerBinder needs to calculate a range size. The returned value should be an approximate range size based on the size of the first measured item.

Link copied to clipboard
abstract fun computeWrappedHeight(maxHeight: Int, componentTreeHolders: List<ComponentTreeHolder>): Int
Link copied to clipboard
abstract fun createViewportFiller(measuredWidth: Int, measuredHeight: Int): LayoutInfo.ViewportFiller?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract fun getChildHeightSpec(heightSpec: Int, renderInfo: RenderInfo): Int
Link copied to clipboard
abstract fun getChildWidthSpec(widthSpec: Int, renderInfo: RenderInfo): Int
Link copied to clipboard
abstract fun getItemCount(): Int
Link copied to clipboard
Link copied to clipboard
abstract fun getScrollDirection(): Int

This is the main scrolling direction that the LayoutManager passed to this binder will use.

Link copied to clipboard
abstract fun scrollToPositionWithOffset(position: Int, offset: Int)

RecyclerBinder delegates scrolling responsibilities to the LayoutInfo, as the varied LayoutManagers wrapped by a LayoutInfo lack a common scrolling interface. Typical implementations should forward the call to the underlying LayoutManager's scrollToPositionWithOffset() or an equivalent.

Link copied to clipboard
abstract fun setRenderInfoCollection(renderInfoCollection: LayoutInfo.RenderInfoCollection?)