ComponentWarmer

Pool for pre-computing and storing ComponentTrees. Can be used to pre-compute and store ComponentTrees before they are inserted in a RecyclerBinder. The RecyclerBinder will fetch the precomputed ComponentTree from the pool if it's available instead of computing a layout calculation when the item needs to be computed.

Constructors

Link copied to clipboard
constructor(c: ComponentContext, widthSpec: Int, heightSpec: Int)

Sets up a ComponentTreeHolderPreparerWithSizeImpl as the ComponentTreeHolderPreparer of this instance. All prepare calls will use the provided width and height specs for preparing, until this instance is configured on a RecyclerBinder and a new ComponentTreeHolderPreparer created by the RecyclerBinder is used, which uses the RecyclerBinder's measurements.

constructor()

Creates a ComponentWarmer instance which is not ready to prepare items yet. If trying to prepare an item before the ComponentWarmer is ready, the requests will be enqueued and will only be executed once this instance is bound to a ComponentTreeHolderPreparer.

constructor(cache: ComponentWarmer.Cache?)
constructor(recyclerBinder: RecyclerBinder, cache: ComponentWarmer.Cache? = null)

Creates a ComponentWarmer for this RecyclerBinder. This ComponentWarmer instance will use the same ComponentTree factory as the RecyclerBinder. The RecyclerBinder will query the ComponentWarmer for cached items before creating new ComponentTrees. Uses a LruCache to manage the internal cache.

Creates a ComponentWarmer which will use the provided ComponentTreeHolderPreparer instance to create ComponentTreeHolder instances for preparing and caching items. Uses a LruCache to manage the internal cache.

Types

Link copied to clipboard
interface Cache
Link copied to clipboard
fun interface CacheListener
Link copied to clipboard
object Companion
Link copied to clipboard
Link copied to clipboard

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Cancels the prepare execution for the item with the given tag if it's currently running and it removes the item from the cache.

Link copied to clipboard

If it exists, it returns the cached ComponentTreeHolder for this tag and removes it from cache.

Link copied to clipboard
fun evictAll()
Link copied to clipboard
fun prepare(tag: String, componentRenderInfo: ComponentRenderInfo, size: Size?, handler: RunnableHandler? = null)

Synchronously prepare the ComponentTree for the given ComponentRenderInfo.

Link copied to clipboard
fun prepareAsync(tag: String, componentRenderInfo: ComponentRenderInfo)

Asynchronously prepare the ComponentTree for the given ComponentRenderInfo.

Link copied to clipboard
fun remove(tag: String)
Link copied to clipboard
fun setReleaseEvictedEntries(releaseEvictedEntries: Boolean)