public class ComponentContext
extends ContextWrapper
Modifier and Type | Field and Description |
---|---|
protected TreeProps |
mTreeProps |
Constructor and Description |
---|
ComponentContext(Context context) |
ComponentContext(Context context,
StateHandler stateHandler) |
ComponentContext(Context context,
StateHandler stateHandler,
KeyHandler keyHandler) |
ComponentContext(Context context,
String logTag,
ComponentsLogger logger)
Constructor that can be used to receive log data from components.
|
Modifier and Type | Method and Description |
---|---|
Component |
getComponentScope() |
ComponentsLogger |
getLogger() |
String |
getLogTag() |
ResourceCache |
getResourceCache() |
String |
getSplitLayoutTag() |
protected TreeProps |
getTreeProps() |
TreeProps |
getTreePropsCopy()
Obtain a copy of the tree props currently held by this context.
|
static boolean |
isIncrementalMountEnabled(ComponentContext c)
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.
|
<E> EventHandler<E> |
newEventHandler(int id,
Object[] params) |
TypedArray |
obtainStyledAttributes(int[] attrs,
int defStyleAttr) |
protected void |
setTreeProps(TreeProps treeProps) |
void |
updateStateAsync(ComponentLifecycle.StateUpdate stateUpdate,
String attribution)
Notify the Component Tree that it needs to asynchronously perform a state update.
|
void |
updateStateLazy(ComponentLifecycle.StateUpdate stateUpdate) |
void |
updateStateSync(ComponentLifecycle.StateUpdate stateUpdate,
String attribution)
Notify the Component Tree that it needs to synchronously perform a state update.
|
void |
updateStateWithTransition(ComponentLifecycle.StateUpdate stateUpdate,
String attribution) |
static ComponentContext |
withComponentScope(ComponentContext context,
Component scope)
Creates a new ComponentContext instance scoped to the given component and sets it on the
component.
|
protected TreeProps mTreeProps
public ComponentContext(Context context)
public ComponentContext(Context context, StateHandler stateHandler)
public ComponentContext(Context context, StateHandler stateHandler, KeyHandler keyHandler)
public ComponentContext(Context context, String logTag, ComponentsLogger logger)
ComponentsLogger
for the type of events you can listen for.context
- Android context.logTag
- Specify a log tag, to be used with the logger.logger
- Specify the lifecycle logger to be used.public static ComponentContext withComponentScope(ComponentContext context, Component scope)
context
- context scoped to the parent componentscope
- component associated with the newly created scoped contextpublic Component getComponentScope()
public void updateStateSync(ComponentLifecycle.StateUpdate stateUpdate, String attribution)
stateUpdate
- state update to performpublic void updateStateAsync(ComponentLifecycle.StateUpdate stateUpdate, String attribution)
stateUpdate
- state update to performpublic void updateStateWithTransition(ComponentLifecycle.StateUpdate stateUpdate, String attribution)
public void updateStateLazy(ComponentLifecycle.StateUpdate stateUpdate)
public TypedArray obtainStyledAttributes(int[] attrs, @AttrRes int defStyleAttr)
public String getLogTag()
@Nullable public ComponentsLogger getLogger()
protected void setTreeProps(TreeProps treeProps)
@Nullable public TreeProps getTreePropsCopy()
public ResourceCache getResourceCache()
public <E> EventHandler<E> newEventHandler(int id, Object[] params)
public static boolean isIncrementalMountEnabled(ComponentContext c)