LazyLayoutPrefetchState



State for lazy items prefetching, used by lazy layouts to instruct the prefetcher.

Note: this class is a part of LazyLayout harness that allows for building custom lazy layouts. LazyLayout and all corresponding APIs are still under development and are subject to change.

Summary

Nested types

Public constructors

LazyLayoutPrefetchState(
    prefetchScheduler: PrefetchScheduler?,
    onNestedPrefetch: (NestedPrefetchScope.() -> Unit)?
)
Cmn

Public functions

LazyLayoutPrefetchState.PrefetchHandle
schedulePrefetch(index: Int, constraints: Constraints?)

Schedules precomposition and premeasure for the new item.

Cmn

Public constructors

LazyLayoutPrefetchState

LazyLayoutPrefetchState(
    prefetchScheduler: PrefetchScheduler? = null,
    onNestedPrefetch: (NestedPrefetchScope.() -> Unit)? = null
)
Parameters
prefetchScheduler: PrefetchScheduler? = null

the PrefetchScheduler implementation to use to execute prefetch requests. If null is provided, the default PrefetchScheduler for the platform will be used.

onNestedPrefetch: (NestedPrefetchScope.() -> Unit)? = null

a callback which will be invoked when this LazyLayout is prefetched in context of a parent LazyLayout, giving a chance to recursively prefetch its own children. See NestedPrefetchScope.

Public functions

schedulePrefetch

fun schedulePrefetch(index: Int, constraints: Constraints? = null): LazyLayoutPrefetchState.PrefetchHandle

Schedules precomposition and premeasure for the new item.

Parameters
index: Int

item index to prefetch.

constraints: Constraints? = null

Constraints to use for premeasuring. If null, the child will not be premeasured.