ComponentWarmer

open class 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 of this instance.
constructor()
Creates a ComponentWarmer instance which is not ready to prepare items yet.
constructor(cache: ComponentWarmer.Cache)
constructor(recyclerBinder: RecyclerBinder)
Creates a ComponentWarmer for this RecyclerBinder.
constructor(recyclerBinder: RecyclerBinder, @Nullable cache: ComponentWarmer.Cache)
Same as ComponentWarmer but uses the passed in Cache instance to manage the internal cache.
Creates a ComponentWarmer which will use the provided ComponentTreeHolderPreparer instance to create ComponentTreeHolder instances for preparing and caching items.
Same as ComponentWarmer but uses the passed in Cache instance to manage the internal cache.

Types

Link copied to clipboard
interface Cache
Link copied to clipboard
interface CacheListener
Link copied to clipboard
Link copied to clipboard

Properties

Link copied to clipboard
val COMPONENT_WARMER_PREPARE_HANDLER: String = "component_warmer_prepare_handler"
Link copied to clipboard
val COMPONENT_WARMER_TAG: String = "component_warmer_tag"
Link copied to clipboard

Functions

Link copied to clipboard
open fun cancelPrepare(tag: String)
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
open fun evictAll()
Link copied to clipboard
open fun isReady(): Boolean
Link copied to clipboard
open fun prepare(tag: String, componentRenderInfo: ComponentRenderInfo, @Nullable size: Size)
Synchronously prepare the ComponentTree for the given ComponentRenderInfo.
open fun prepare(tag: String, componentRenderInfo: ComponentRenderInfo, @Nullable size: Size, handler: RunnableHandler)
Synchronously post preparing the ComponentTree for the given ComponentRenderInfo to the handler.
Link copied to clipboard
open fun prepareAsync(tag: String, componentRenderInfo: ComponentRenderInfo)
Asynchronously prepare the ComponentTree for the given ComponentRenderInfo.
Link copied to clipboard
open fun remove(tag: String)
Link copied to clipboard
open fun setReleaseEvictedEntries(releaseEvictedEntries: Boolean)