LithoCollectionItem

class LithoCollectionItem(componentContext: ComponentContext, id: Int = LithoTree.generateComponentTreeId(), viewType: Int = DEFAULT_COMPONENT_VIEW_TYPE, renderInfo: RenderInfo, runnableHandlerProvider: RunnableHandlerProvider = ComponentTree.DefaultLayoutHandlerProvider(), onChildMeasured: (LithoCollectionItem, IntSize) -> Unit = { _, _ -> }, prioritizeBoundRows: Boolean = false) : CollectionItem<LithoRenderTreeView>

A CollectionItem that renders a LithoRenderTreeView.

Constructors

Link copied to clipboard
constructor(componentContext: ComponentContext, id: Int = LithoTree.generateComponentTreeId(), viewType: Int = DEFAULT_COMPONENT_VIEW_TYPE, renderInfo: RenderInfo, runnableHandlerProvider: RunnableHandlerProvider = ComponentTree.DefaultLayoutHandlerProvider(), onChildMeasured: (LithoCollectionItem, IntSize) -> Unit = { _, _ -> }, prioritizeBoundRows: Boolean = false)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val id: Int

The unique identifier for this item in the RecyclerView.Adapter

Link copied to clipboard

Contains information about how to render this item

Link copied to clipboard
open override val size: IntSize

Returns the size of this collection item.

Link copied to clipboard
open override val sizeConstraints: SizeConstraints?

Returns the size constraints that define the measurement boundaries for this collection item. These constraints specify the minimum and maximum width and height values that should be used when measuring and laying out the item.

Link copied to clipboard

The type identifier used for this item in the RecyclerView.Adapter

Functions

Link copied to clipboard
fun CollectionItem<*>.areSizeConstraintsCompatible(constraints: SizeConstraints): Boolean

Checks if the provided size constraints are compatible with this CollectionItem's current size constraints and measured size.

Link copied to clipboard
open override fun measure(sizeConstraints: SizeConstraints, result: IntArray?)

Measures the item according to the given size constraints.

Link copied to clipboard

Binds data and properties to the view when it's being displayed in the collection. This method is called when the RecyclerView needs to display the item at a specific position within the ItemSizeConstraintsProviderScope, which provides access to size constraint information during the binding process.

Link copied to clipboard
open override fun onViewRecycled(view: LithoRenderTreeView)

Called when a view has been recycled and is no longer being displayed in the collection. This method should clean up any resources, listeners, or bindings associated with the view to prevent memory leaks and ensure proper recycling behavior.

Link copied to clipboard
open override fun PrepareScope.prepare()
Link copied to clipboard
open override fun prepareAsync(sizeConstraints: SizeConstraints)

Prepares the item for rendering. This method can be called for explicit async preparation of the item outside from outside the Range Manager.

Link copied to clipboard
open override fun PrepareScope.unprepare()