ComponentContext

open class ComponentContext

A Context subclass for use within the Components framework. Contains extra bookkeeping information used internally in the library.

Constructors

Link copied to clipboard
constructor(context: Context)
This constructors takes a Context.
constructor(context: Context, @Nullable lithoConfiguration: LithoConfiguration, @Nullable treePropContainer: TreePropContainer)
constructor(context: ComponentContext)

Functions

Link copied to clipboard
inline fun ComponentContext.boolAttr(@AttrRes attrResId: Int, @BoolRes defResId: Int = 0): Boolean

Return a boolean for an attribute resource ID.

Link copied to clipboard

Return a boolean for a resource ID.

Link copied to clipboard
open fun calculateLayoutOutputId(componentKey: String, type: Int): Long
Calculates a returns a unique ID for a given component key and output type.
Link copied to clipboard
inline fun ComponentContext.colorAttr(@AttrRes id: Int, @ColorRes defResId: Int = 0): Int

Return a ColorInt value, corresponding to an attribute resource ID. If given attribute ID can not be found, default color resource ID defResId is used.

Link copied to clipboard

Return a ColorInt value for a color resource ID.

Link copied to clipboard
inline fun ComponentContext.dimenAttr(@AttrRes id: Int, @DimenRes defResId: Int = 0): Dimen

Return a dimen for an attribute resource ID.

Link copied to clipboard
inline fun ComponentContext.dimenRes(@DimenRes id: Int): Dimen

Resolve a dimen resource ID as a Dimen value.

Link copied to clipboard
inline fun ComponentContext.drawableAttr(@AttrRes id: Int, @DrawableRes defResId: Int = 0): Drawable

Retrieve a android.graphics.drawable.Drawable, corresponding to an attribute resource ID, as a Drawable instance. If given attribute ID can not be found, default Drawable resource ID defResId is used.

Link copied to clipboard

Retrieve a android.graphics.drawable.Drawable for a resource ID as a Drawable instance.

Link copied to clipboard
open fun <T : View?> findViewWithTag(tag: Any): T
A utility function to find the View with a given tag under the current Component's LithoView.
Link copied to clipboard
open fun findViewWithTagValue(key: Int, tag: Any): View
A utility function to find the View with a given tag under the current Component's LithoView.
Link copied to clipboard
inline fun ComponentContext.floatAttr(@AttrRes id: Int, @DimenRes defResId: Int = 0): Float
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getCachedValue(globalKey: String, index: Int, cachedValueInputs: Any): Any
Link copied to clipboard
open fun getColor(@ColorRes id: Int): Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getGlobalKey(): String
Link copied to clipboard
open fun getLayoutVersion(): Int
Link copied to clipboard
Link copied to clipboard
open fun getLogger(): ComponentsLogger
Link copied to clipboard
Link copied to clipboard
open fun <T> getParentTreeProp(key: Class<T>): T
Link copied to clipboard
open fun getResourceCache(): ResourceCache
Link copied to clipboard
open fun getResourceResolver(): ResourceResolver
Link copied to clipboard
Link copied to clipboard
open fun getString(@StringRes resId: Int): String
open fun getString(@StringRes resId: Int, formatArgs: Array<Any>): String
Link copied to clipboard
open fun getText(@StringRes resId: Int): CharSequence
Link copied to clipboard
open fun <T> getTreeProp(key: Class<T>): T
Link copied to clipboard
Obtain a copy of the tree props currently held by this context.
Link copied to clipboard
inline fun ComponentContext.intAttr(@AttrRes id: Int, @IntegerRes defResId: Int = 0): Int
Link copied to clipboard
Link copied to clipboard
Checks if incremental mount is enabled given a ComponentContext, so you can throw an error if you require that incremental mount is enabled (e.g.
Link copied to clipboard
Creates a new ComponentContext based on the given ComponentContext, propagating log tag, logger, and tree props.
Link copied to clipboard
open fun obtainStyledAttributes(attrs: Array<Int>, @AttrRes defStyleAttr: Int): TypedArray
Link copied to clipboard
open fun putCachedValue(globalKey: String, index: Int, cachedValueInputs: Any, @Nullable cachedValue: Any)
Link copied to clipboard
inline fun ComponentContext.quantityStringRes(@PluralsRes id: Int, quantity: Int, arg: Any): String
inline fun ComponentContext.quantityStringRes(@PluralsRes id: Int, quantity: Int, vararg formatArgs: Any): String
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun ComponentContext.stringAttr(@AttrRes attrResId: Int, @StringRes defResId: Int = 0): String

Return a string for an attribute resource ID.

Link copied to clipboard

Return a string for a resource ID.

Return a string for a resource ID, substituting the format arguments with arg.

inline fun ComponentContext.stringRes(@StringRes id: Int, vararg formatArgs: Any): String

Return a string for a resource ID, substituting the format arguments with formatArgs.

Link copied to clipboard
open fun updateStateAsync(stateUpdate: StateContainer.StateUpdate, attribution: String)
Notify the Component Tree that it needs to asynchronously perform a state update.
Link copied to clipboard
Link copied to clipboard
open fun updateStateSync(stateUpdate: StateContainer.StateUpdate, attribution: String)
Notify the Component Tree that it needs to synchronously perform a state update.
Link copied to clipboard
open fun updateStateWithTransition(stateUpdate: StateContainer.StateUpdate, attribution: String)