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() |
TypedArray |
obtainStyledAttributes(int[] attrs,
int defStyleAttr) |
void |
registerTrigger(EventTrigger trigger,
String key)
Keep a referenece to
EventTrigger in ComponentTree to allow a retrieval of the
same reference with a key. |
protected void |
setTreeProps(TreeProps treeProps) |
void |
unregisterTrigger(String key)
Remove a referenece of
EventTrigger in ComponentTree with the key it was
registered with. |
void |
updateState(ComponentLifecycle.StateUpdate stateUpdate)
Notify the Component Tree that it needs to synchronously perform a state update.
|
void |
updateStateAsync(ComponentLifecycle.StateUpdate stateUpdate)
Notify the Component Tree that it needs to asynchronously perform a state update.
|
void |
updateStateLazy(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 updateState(ComponentLifecycle.StateUpdate stateUpdate)
stateUpdate
- state update to performpublic void updateStateAsync(ComponentLifecycle.StateUpdate stateUpdate)
stateUpdate
- state update to performpublic 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 void registerTrigger(EventTrigger trigger, String key)
EventTrigger
in ComponentTree
to allow a retrieval of the
same reference with a key.public void unregisterTrigger(String key)
EventTrigger
in ComponentTree
with the key it was
registered with.