ComponentContext
A Context subclass for use within the Components framework. Contains extra bookkeeping information used internally in the library.
Constructors
This constructors takes a Context. This should only be used to create ComponentTree
Properties
Functions
This method determine if transitions are enabled for the user. If the experiment is enabled for the user then they will get cached value else it will be determined using the utility method.
Wraps this existing ComponentContext in a ResourcesScope, for calling the ResourcesScope DSL (Row, Column, widgets such as Card) from code that already holds a ComponentContext but has no ambient ComponentScope — e.g. a @LayoutSpec helper or a builder-style function.
Calculates a returns a unique ID for a given component key and output type. The IDs will be unique for components in the ComponentTree this ID generator is linked with. If an ID was already generated for a given component, the same ID will be returned. Otherwise, a new unique ID will be generated.
Resolve a dimen resource ID as a Dimen value.
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.
Retrieve a android.graphics.drawable.Drawable for a resource ID as a Drawable instance.
A utility function to find the View with a given tag under the current Component's LithoView. To set a view tag, use the .viewTag() common prop or Style.viewTag. An appropriate time to call this is in your Component's onVisible callback.
A utility function to find the View with a given tag under the current Component's LithoView. To set a view tag, use the .viewTags() common prop or Style.viewTags. An appropriate time to call this is in your Component's onVisible callback.
Temporary workaround to suppress the "measure in resolve" violation policy.
Retrieve a android.graphics.drawable.Drawable for a resource ID as a Drawable instance, or null if the resource ID is zero or null.
For test usage. This method will ensure this ComponentContext has a RenderStateContex. This is critical for tests that trigger layout calculation functionality outside of a LayoutState calculation (i.e., including willRender, Layout API, caching, etc).
Return a string for an attribute resource ID.
Return a string for a resource ID.
Return a string for a resource ID, substituting the format arguments with arg.
Return a string for a resource ID, substituting the format arguments with formatArgs.
Notify the Component Tree that it needs to asynchronously perform a state update.
Variant of updateStateAsync that asserts the update is performed with the ComponentContext of reference — the component that owns the state. Generated by the Spec annotation processor for @OnUpdateState methods; see assertValidStateUpdateContext.
Variant of updateStateLazy that asserts the update is performed with the ComponentContext of reference — the component that owns the state. Generated by the Spec annotation processor for lazy state updates; see assertValidStateUpdateContext.
Notify the Component Tree that it needs to synchronously perform a state update.
Variant of updateStateSync that asserts the update is performed with the ComponentContext of reference — the component that owns the state. Generated by the Spec annotation processor for @OnUpdateState methods; see assertValidStateUpdateContext.
Variant of updateStateWithTransition that asserts the update is performed with the ComponentContext of reference — the component that owns the state. Generated by the Spec annotation processor for @OnUpdateStateWithTransition methods.