public abstract class SpecGeneratedComponent extends Component implements ContentAllocator, EventTriggerTarget, HasEventTrigger
Modifier and Type | Class and Description |
---|---|
static interface |
SpecGeneratedComponent.TransitionContainer
Generated component's state container could implement this interface along with
StateContainer when componentspec specifies state update method with OnUpdateStateWithTransition annotation. |
Component.Builder<T extends Component.Builder<T>>, Component.ContainerBuilder<T extends Component.ContainerBuilder<T>>, Component.MountType, Component.RenderData
Modifier | Constructor and Description |
---|---|
protected |
SpecGeneratedComponent(int identityHashCode,
java.lang.String simpleName) |
protected |
SpecGeneratedComponent(java.lang.String simpleName) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
acceptTriggerEvent(EventTrigger eventTrigger,
java.lang.Object eventState,
java.lang.Object[] params) |
protected java.lang.Object |
acceptTriggerEventImpl(EventTrigger eventTrigger,
java.lang.Object eventState,
java.lang.Object[] params) |
protected void |
applyPreviousRenderData(Component.RenderData previousRenderData) |
protected void |
bindDynamicProp(int dynamicPropIndex,
java.lang.Object value,
java.lang.Object content) |
boolean |
canPreallocate()
This API informs the framework to fill the content pool for this Mountable ahead of time.
|
protected void |
copyInterStageImpl(InterStagePropsContainer copyIntoInterStagePropsContainer,
InterStagePropsContainer copyFromInterStagePropsContainer) |
protected void |
copyPrepareInterStageImpl(PrepareInterStagePropsContainer copyIntoInterStagePropsContainer,
PrepareInterStagePropsContainer copyFromInterStagePropsContainer) |
java.lang.Object |
createContent(Context context)
Allocates the mountable content (View or Drawable).
|
protected void |
createInitialState(ComponentContext c) |
protected InterStagePropsContainer |
createInterStagePropsContainer() |
java.lang.Object |
createPoolableContent(Context context)
Creates a mount-content that can be pooled.
|
protected PrepareInterStagePropsContainer |
createPrepareInterStagePropsContainer() |
MountItemsPool.ItemPool |
createRecyclingPool()
Creates an ItemPool for this mountable content.
|
protected StateContainer |
createStateContainer() |
protected void |
dispatchOnEnteredRange(ComponentContext c,
java.lang.String name) |
protected void |
dispatchOnExitedRange(ComponentContext c,
java.lang.String name) |
protected int |
getExtraAccessibilityNodeAt(ComponentContext c,
int x,
int y,
InterStagePropsContainer InterStagePropsContainer)
Get extra accessibility node id at a given point within the component.
|
protected int |
getExtraAccessibilityNodesCount(ComponentContext c,
InterStagePropsContainer interStagePropsContainer)
The number of extra accessibility nodes that this component wishes to provides to the
accessibility system.
|
protected InterStagePropsContainer |
getInterStagePropsContainer(ComponentContext scopedContext,
InterStagePropsContainer interStagePropsContainer) |
java.lang.Object |
getPoolableContentType()
Returns an object defining the type of the mount-content.
|
protected PrepareInterStagePropsContainer |
getPrepareInterStagePropsContainer(ComponentContext scopedContext) |
java.lang.String |
getSimpleName()
Should only be used by logging to provide more readable messages.
|
protected Component |
getSimpleNameDelegate() |
protected TreeProps |
getTreePropsForChildren(ComponentContext c,
TreeProps treeProps)
Updates the TreeProps map with outputs from all
OnCreateTreeProp methods. |
protected boolean |
hasAttachDetachCallback() |
protected boolean |
hasOwnErrorHandler()
This method is overridden in the generated component to return true if and only if the
Component Spec has an OnError lifecycle callback.
|
protected boolean |
hasState() |
protected boolean |
implementsAccessibility()
Whether this component will populate any accessibility nodes or events that are passed to it.
|
protected boolean |
implementsExtraAccessibilityNodes()
Whether this component will expose any virtual views to the accessibility framework
|
protected boolean |
isMountSizeDependent() |
boolean |
isRecyclingDisabled()
Return true if pooling should be disabled for this mount content.
|
protected boolean |
needsPreviousRenderData() |
protected void |
onAttached(ComponentContext c)
Called when the component is attached to the
ComponentTree . |
protected void |
onBind(ComponentContext c,
java.lang.Object mountedContent,
InterStagePropsContainer interStagePropsContainer) |
protected void |
onBoundsDefined(ComponentContext c,
ComponentLayout layout,
InterStagePropsContainer interStagePropsContainer)
Called after the layout calculation is finished and the given
ComponentLayout has its
bounds defined. |
protected Component |
onCreateLayout(ComponentContext c)
Generate a tree of
ComponentLayout representing the layout structure of the Component and its sub-components. |
protected Component |
onCreateLayoutWithSizeSpec(ComponentContext c,
int widthSpec,
int heightSpec) |
MountContentPool |
onCreateMountContentPool()
Creates the content pool the framework should use for this Mountable.
|
protected void |
onDetached(ComponentContext c)
Called when the component is detached from the
ComponentTree . |
protected void |
onError(ComponentContext c,
java.lang.Exception e)
Called to provide a fallback if a supported lifecycle method throws an exception.
|
protected void |
onMeasure(ComponentContext c,
ComponentLayout layout,
int widthSpec,
int heightSpec,
Size size,
InterStagePropsContainer interStagePropsContainer) |
protected int |
onMeasureBaseline(ComponentContext c,
int width,
int height,
InterStagePropsContainer interStagePropsContainer)
Called during layout calculation to determine the baseline of a component.
|
protected void |
onMount(ComponentContext c,
java.lang.Object convertContent,
InterStagePropsContainer interStagePropsContainer)
Deploy all UI elements representing the final bounds defined in the given
ComponentLayout . |
protected void |
onPrepare(ComponentContext c) |
protected void |
onUnbind(ComponentContext c,
java.lang.Object mountedContent,
InterStagePropsContainer interStagePropsContainer) |
protected void |
onUnmount(ComponentContext c,
java.lang.Object mountedContent,
InterStagePropsContainer interStagePropsContainer)
Unload UI elements associated with this component.
|
int |
poolSize()
This API informs the framework about the size of the content pool.
|
protected void |
populateTreeProps(TreeProps parentTreeProps)
Retrieves all of the tree props used by this Component from the TreeProps map and sets the tree
props as fields on the ComponentImpl.
|
protected PrepareResult |
prepare(RenderStateContext renderStateContext,
ComponentContext c) |
void |
recordEventTrigger(ComponentContext c,
EventTriggersContainer container) |
protected Component.RenderData |
recordRenderData(ComponentContext c,
Component.RenderData toRecycle) |
protected RenderResult |
render(RenderStateContext renderStateContext,
ComponentContext c,
int widthSpec,
int heightSpec)
Invokes the Component-specific render implementation, returning a RenderResult.
|
protected boolean |
shouldAlwaysRemeasure() |
protected boolean |
usesLocalStateContainer() |
canMeasure, clone, createMountContent, dispatchErrorEvent, dispatchOnEvent, dispatchOnEventImpl, equals, excludeFromIncrementalMount, getCommonProps, getDynamicProps, getErrorHandler, getEventDispatcher, getEventTrigger, getEventTrigger, getHandle, getMountType, getTreePropFromParent, getTypeId, hasChildLithoViews, hasClickHandlerSet, hashCode, implementsShouldUpdate, isEqualivalentTreeProps, isEquivalentCommonProps, isEquivalentProps, isEquivalentTo, isEquivalentTo, isLayoutSpecWithSizeSpec, isPureRender, isPureRender, makeShallowCopy, measure, measure, measureMightNotCacheInternalNode, newEventHandler, newEventTrigger, newEventTrigger, onCreateMountContent, onCreateTransition, onLoadStyle, onPopulateAccessibilityNode, onPopulateExtraAccessibilityNode, registerWorkingRange, resolve, retrieveValue, shouldUpdate, toString, transferState, willRender
protected SpecGeneratedComponent(java.lang.String simpleName)
protected SpecGeneratedComponent(int identityHashCode, java.lang.String simpleName)
public final java.lang.String getSimpleName()
getSimpleName
in class Component
protected StateContainer createStateContainer()
protected Component getSimpleNameDelegate()
LayoutSpec#simpleNameDelegate()
protected RenderResult render(RenderStateContext renderStateContext, ComponentContext c, int widthSpec, int heightSpec)
Component
#resolve(LayoutStateContext, ComponentContext)
'ed), as well as other
metadata from that render call such as transitions that should be applied.protected final PrepareResult prepare(RenderStateContext renderStateContext, ComponentContext c)
public void recordEventTrigger(ComponentContext c, EventTriggersContainer container)
recordEventTrigger
in interface HasEventTrigger
protected Component onCreateLayout(ComponentContext c)
ComponentLayout
representing the layout structure of the Component
and its sub-components.c
- The ComponentContext
to build a ComponentLayout
tree.protected Component onCreateLayoutWithSizeSpec(ComponentContext c, int widthSpec, int heightSpec)
protected void onPrepare(ComponentContext c)
protected boolean usesLocalStateContainer()
usesLocalStateContainer
in class Component
public final java.lang.Object acceptTriggerEvent(EventTrigger eventTrigger, java.lang.Object eventState, java.lang.Object[] params)
acceptTriggerEvent
in interface EventTriggerTarget
protected java.lang.Object acceptTriggerEventImpl(EventTrigger eventTrigger, java.lang.Object eventState, java.lang.Object[] params)
protected void applyPreviousRenderData(Component.RenderData previousRenderData)
protected void bindDynamicProp(int dynamicPropIndex, java.lang.Object value, java.lang.Object content)
protected void copyInterStageImpl(InterStagePropsContainer copyIntoInterStagePropsContainer, InterStagePropsContainer copyFromInterStagePropsContainer)
protected void copyPrepareInterStageImpl(PrepareInterStagePropsContainer copyIntoInterStagePropsContainer, PrepareInterStagePropsContainer copyFromInterStagePropsContainer)
protected void createInitialState(ComponentContext c)
protected InterStagePropsContainer createInterStagePropsContainer()
protected PrepareInterStagePropsContainer createPrepareInterStagePropsContainer()
protected void dispatchOnEnteredRange(ComponentContext c, java.lang.String name)
protected void dispatchOnExitedRange(ComponentContext c, java.lang.String name)
protected int getExtraAccessibilityNodeAt(ComponentContext c, int x, int y, InterStagePropsContainer InterStagePropsContainer)
x
- x co-ordinate within the mounted componenty
- y co-ordinate within the mounted componentExploreByTouchHelper#INVALID_ID
protected int getExtraAccessibilityNodesCount(ComponentContext c, InterStagePropsContainer interStagePropsContainer)
protected final InterStagePropsContainer getInterStagePropsContainer(ComponentContext scopedContext, InterStagePropsContainer interStagePropsContainer)
protected final PrepareInterStagePropsContainer getPrepareInterStagePropsContainer(ComponentContext scopedContext)
protected TreeProps getTreePropsForChildren(ComponentContext c, TreeProps treeProps)
OnCreateTreeProp
methods.protected boolean hasAttachDetachCallback()
OnAttached
or OnDetached
delegate
methods.protected boolean hasOwnErrorHandler()
protected boolean hasState()
protected boolean implementsAccessibility()
protected boolean implementsExtraAccessibilityNodes()
protected boolean isMountSizeDependent()
protected boolean needsPreviousRenderData()
protected void onAttached(ComponentContext c)
ComponentTree
.c
- The ComponentContext
the Component was constructed with.protected void onBind(ComponentContext c, java.lang.Object mountedContent, InterStagePropsContainer interStagePropsContainer)
protected void onBoundsDefined(ComponentContext c, ComponentLayout layout, InterStagePropsContainer interStagePropsContainer)
ComponentLayout
has its
bounds defined. You can use ComponentLayout.getX()
, ComponentLayout.getY()
,
ComponentLayout.getWidth()
, and ComponentLayout.getHeight()
to get the size and
position of the component in the layout tree.c
- The Context
used by this component.layout
- The ComponentLayout
with defined position and size.protected void onDetached(ComponentContext c)
ComponentTree
.c
- The ComponentContext
the Component was constructed with.protected void onError(ComponentContext c, java.lang.Exception e)
c
- The ComponentContext
the Component was constructed with.e
- The exception caught.OnError
protected void onMeasure(ComponentContext c, ComponentLayout layout, int widthSpec, int heightSpec, Size size, InterStagePropsContainer interStagePropsContainer)
protected int onMeasureBaseline(ComponentContext c, int width, int height, InterStagePropsContainer interStagePropsContainer)
c
- The Context
used by this component.width
- The width of this component.height
- The height of this component.interStagePropsContainer
- protected void onMount(ComponentContext c, java.lang.Object convertContent, InterStagePropsContainer interStagePropsContainer)
ComponentLayout
. Return either a Drawable
or a View
or null
to be
mounted.c
- The ComponentContext
to mount the component into.protected void onUnbind(ComponentContext c, java.lang.Object mountedContent, InterStagePropsContainer interStagePropsContainer)
protected void onUnmount(ComponentContext c, java.lang.Object mountedContent, InterStagePropsContainer interStagePropsContainer)
c
- The Context
for this mount operation.mountedContent
- The Drawable
or View
mounted by this component.interStagePropsContainer
- protected void populateTreeProps(TreeProps parentTreeProps)
protected Component.RenderData recordRenderData(ComponentContext c, Component.RenderData toRecycle)
protected boolean shouldAlwaysRemeasure()
public java.lang.Object createContent(Context context)
ContentAllocator
createContent
in interface ContentAllocator
public java.lang.Object createPoolableContent(Context context)
ContentAllocator
createPoolableContent
in interface ContentAllocator
public java.lang.Object getPoolableContentType()
ContentAllocator
getPoolableContentType
in interface ContentAllocator
public boolean isRecyclingDisabled()
ContentAllocator
isRecyclingDisabled
in interface ContentAllocator
public MountItemsPool.ItemPool createRecyclingPool()
ContentAllocator
createRecyclingPool
in interface ContentAllocator
public boolean canPreallocate()
ContentAllocator
false
, i.e. content is not pre-allocated. Pre-allocation of the
content can improve performance in some circumstances where creating the content is expensive.canPreallocate
in interface ContentAllocator
public MountContentPool onCreateMountContentPool()
ContentAllocator
Experimental. Currently for Litho team internal use only.
onCreateMountContentPool
in interface ContentAllocator
public int poolSize()
ContentAllocator
Experimental. Currently for Litho team internal use only.
poolSize
in interface ContentAllocator