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 |
---|---|
void |
enterNoStateUpdatesMethod(String noStateUpdatesMethod) |
void |
exitNoStateUpdatesMethod() |
Component |
getComponentScope() |
ComponentsLogger |
getLogger() |
String |
getLogTag() |
ResourceCache |
getResourceCache() |
protected TreeProps |
getTreeProps() |
<E> EventHandler<E> |
newEventHandler(int id,
Object[] params) |
TypedArray |
obtainStyledAttributes(int[] attrs,
int defStyleAttr) |
protected void |
setTreeProps(TreeProps treeProps) |
void |
updateStateAsync(ComponentLifecycle.StateUpdate stateUpdate)
Notify the Component Tree that it needs to asynchronously perform a state update.
|
void |
updateStateLazy(ComponentLifecycle.StateUpdate stateUpdate) |
void |
updateStateSync(ComponentLifecycle.StateUpdate stateUpdate)
Notify the Component Tree that it needs to synchronously perform a state update.
|
void |
updateStateWithTransition(ComponentLifecycle.StateUpdate stateUpdate) |
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)
stateUpdate
- state update to performpublic void updateStateAsync(ComponentLifecycle.StateUpdate stateUpdate)
stateUpdate
- state update to performpublic void updateStateWithTransition(ComponentLifecycle.StateUpdate stateUpdate)
public void updateStateLazy(ComponentLifecycle.StateUpdate stateUpdate)
public void enterNoStateUpdatesMethod(String noStateUpdatesMethod)
public void exitNoStateUpdatesMethod()
public TypedArray obtainStyledAttributes(int[] attrs, @AttrRes int defStyleAttr)
public String getLogTag()
@Nullable public ComponentsLogger getLogger()
protected void setTreeProps(TreeProps treeProps)
public ResourceCache getResourceCache()
public <E> EventHandler<E> newEventHandler(int id, Object[] params)