LithoCollectionItem

class LithoCollectionItem(componentContext: ComponentContext, id: Int = LithoTree.generateComponentTreeId(), viewType: Int = DEFAULT_COMPONENT_VIEW_TYPE, renderInfo: RenderInfo) : 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)

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: Size?

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
open override fun onBindView(view: LithoRenderTreeView, sizeConstraints: SizeConstraints)

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.

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 prepare(sizeConstraints: SizeConstraints)

To prepare the item for rendering in async way. This is going to be used in the range preparation.

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

To prepare the item for rendering in sync way.

Link copied to clipboard
open override fun unprepare()

To unprepare the item, which is called after the item is being released by the range preparation.