public final class RecyclerCollectionComponent extends SpecGeneratedComponent
Component
that renders a Recycler
backed by a Section
tree. See recycler-collection-component
for details.
This Component
handles the loading events from the Section
hierarchy and shows
the appropriate error,loading or empty Component
passed in as props. If either the empty
or the error components are not passed in and the RecyclerCollectionComponent
is in one
of these states it will simply not render anything.
The RecyclerCollectionComponent
also exposes a LoadEventsHandler
and a OnScrollListener
as Prop
s so its users can receive events about the state of the loading
and about the state of the Recycler
scrolling.
clipToPadding, clipChildren, itemDecoration, scrollBarStyle, horizontalPadding,
verticalPadding and recyclerViewId Prop
s will be directly applied to the Recycler
component.
The RecyclerCollectionEventsController
Prop
is a way to send commands to the
RecyclerCollectionComponentSpec
, such as scrollTo(position) and refresh().
To trigger scrolling from the Section use SectionLifecycle#requestFocus(SectionContext,
int)
. See communicating-with-the-ui
for details.
com.facebook.litho.sections.widget.RecyclerCollectionComponentSpec
Modifier and Type | Class and Description |
---|---|
static class |
RecyclerCollectionComponent.Builder |
SpecGeneratedComponent.TransitionContainer
Component.ContainerBuilder<T extends Component.ContainerBuilder<T>>, Component.MountType, Component.RenderData
Modifier and Type | Method and Description |
---|---|
protected java.lang.Object |
acceptTriggerEventImpl(EventTrigger eventTrigger,
java.lang.Object eventState,
java.lang.Object[] params) |
static RecyclerCollectionComponent.Builder |
create(ComponentContext context) |
static RecyclerCollectionComponent.Builder |
create(ComponentContext context,
int defStyleAttr,
int defStyleRes) |
protected void |
createInitialState(ComponentContext c) |
protected com.facebook.litho.sections.widget.RecyclerCollectionComponent.RecyclerCollectionComponentStateContainer |
createStateContainer() |
protected java.lang.Object |
dispatchOnEventImpl(EventHandler eventHandler,
java.lang.Object eventState) |
static EventHandler<PTRRefreshEvent> |
getPTRRefreshEventHandler(ComponentContext context) |
protected boolean |
hasAttachDetachCallback() |
protected boolean |
hasState() |
protected static void |
lazyUpdateHasSetSectionTreeRoot(ComponentContext c,
boolean lazyUpdateValue) |
RecyclerCollectionComponent |
makeShallowCopy() |
static void |
onClearRefreshing(ComponentContext c,
Handle handle)
This will send the onClearRefreshing trigger to the component with the given handle.
|
static void |
onClearRefreshing(ComponentContext c,
java.lang.String key)
Deprecated.
Use
onClearRefreshing(ComponentContext, Handle) instead. |
static void |
onClearRefreshing(EventTrigger trigger)
Deprecated.
Use
onClearRefreshing(ComponentContext, Handle) instead. |
static EventTrigger<ClearRefreshingEvent> |
onClearRefreshingTrigger(ComponentContext c,
java.lang.String key)
Deprecated.
Do not use this method to get a EventTrigger to use later. Instead give the component a Handle and use
onClearRefreshing(ComponentContext, Handle) . |
protected Component |
onCreateLayout(ComponentContext c)
Generate a tree of
ComponentLayout representing the layout structure of the Component and its sub-components. |
protected void |
onDetached(ComponentContext c)
Called when the component is detached from the
ComponentTree . |
static void |
onRecyclerConfigChanged(ComponentContext c,
Handle handle,
int commitPolicy)
This will send the onRecyclerConfigChanged trigger to the component with the given handle.
|
static void |
onRecyclerConfigChanged(ComponentContext c,
java.lang.String key,
int commitPolicy)
Deprecated.
Use
#onRecyclerConfigChanged(ComponentContext, Handle) instead. |
static void |
onRecyclerConfigChanged(EventTrigger trigger,
int commitPolicy)
Deprecated.
Use
#onRecyclerConfigChanged(ComponentContext, Handle) instead. |
static EventTrigger<RecyclerDynamicConfigEvent> |
onRecyclerConfigChangedTrigger(ComponentContext c,
java.lang.String key)
Deprecated.
Do not use this method to get a EventTrigger to use later. Instead give the component a Handle and use
#onRecyclerConfigChanged(ComponentContext, Handle) . |
static EventHandler<PTRRefreshEvent> |
onRefresh(ComponentContext c,
SectionTree sectionTree) |
static void |
onScroll(ComponentContext c,
Handle handle,
int position,
boolean animate)
This will send the onScroll trigger to the component with the given handle.
|
static void |
onScroll(ComponentContext c,
java.lang.String key,
int position,
boolean animate)
Deprecated.
Use
#onScroll(ComponentContext, Handle) instead. |
static void |
onScroll(EventTrigger trigger,
int position,
boolean animate)
Deprecated.
Use
#onScroll(ComponentContext, Handle) instead. |
static EventTrigger<ScrollEvent> |
onScrollTrigger(ComponentContext c,
java.lang.String key)
Deprecated.
Do not use this method to get a EventTrigger to use later. Instead give the component a Handle and use
#onScroll(ComponentContext, Handle) . |
void |
recordEventTrigger(ComponentContext c,
EventTriggersContainer container) |
protected void |
transferState(StateContainer _prevStateContainer,
StateContainer _nextStateContainer)
|
protected static void |
updateLoadingState(ComponentContext c,
RecyclerCollectionComponentSpec.LoadingState currentLoadingState) |
protected static void |
updateLoadingStateAsync(ComponentContext c,
RecyclerCollectionComponentSpec.LoadingState currentLoadingState) |
protected static void |
updateLoadingStateSync(ComponentContext c,
RecyclerCollectionComponentSpec.LoadingState currentLoadingState) |
acceptTriggerEvent, applyPreviousRenderData, bindDynamicProp, canPreallocate, copyInterStageImpl, copyPrepareInterStageImpl, createContent, createInterStagePropsContainer, createPoolableContent, createPrepareInterStagePropsContainer, createRecyclingPool, dispatchOnEnteredRange, dispatchOnExitedRange, getExtraAccessibilityNodeAt, getExtraAccessibilityNodesCount, getInterStagePropsContainer, getPoolableContentType, getPrepareInterStagePropsContainer, getSimpleName, getSimpleNameDelegate, getTreePropsForChildren, hasOwnErrorHandler, implementsAccessibility, implementsExtraAccessibilityNodes, isMountSizeDependent, isRecyclingDisabled, needsPreviousRenderData, onAttached, onBind, onBoundsDefined, onCreateLayoutWithSizeSpec, onCreateMountContentPool, onError, onMeasure, onMeasureBaseline, onMount, onPrepare, onUnbind, onUnmount, poolSize, populateTreeProps, prepare, recordRenderData, render, shouldAlwaysRemeasure, usesLocalStateContainer
canMeasure, clone, createMountContent, dispatchErrorEvent, dispatchOnEvent, equals, excludeFromIncrementalMount, getCommonProps, getDynamicProps, getErrorHandler, getEventDispatcher, getEventTrigger, getEventTrigger, getHandle, getMountType, getTreePropFromParent, getTypeId, hasChildLithoViews, hasClickHandlerSet, hashCode, implementsShouldUpdate, isEqualivalentTreeProps, isEquivalentCommonProps, isEquivalentProps, isEquivalentTo, isEquivalentTo, isLayoutSpecWithSizeSpec, isPureRender, isPureRender, measure, measure, measureMightNotCacheInternalNode, newEventHandler, newEventTrigger, newEventTrigger, onCreateMountContent, onCreateTransition, onLoadStyle, onPopulateAccessibilityNode, onPopulateExtraAccessibilityNode, registerWorkingRange, resolve, retrieveValue, shouldUpdate, toString, willRender
protected com.facebook.litho.sections.widget.RecyclerCollectionComponent.RecyclerCollectionComponentStateContainer createStateContainer()
createStateContainer
in class SpecGeneratedComponent
public RecyclerCollectionComponent makeShallowCopy()
makeShallowCopy
in class Component
protected Component onCreateLayout(ComponentContext c)
SpecGeneratedComponent
ComponentLayout
representing the layout structure of the Component
and its sub-components.onCreateLayout
in class SpecGeneratedComponent
c
- The ComponentContext
to build a ComponentLayout
tree.protected void createInitialState(ComponentContext c)
createInitialState
in class SpecGeneratedComponent
protected void onDetached(ComponentContext c)
SpecGeneratedComponent
ComponentTree
.onDetached
in class SpecGeneratedComponent
c
- The ComponentContext
the Component was constructed with.protected boolean hasAttachDetachCallback()
hasAttachDetachCallback
in class SpecGeneratedComponent
OnAttached
or OnDetached
delegate
methods.public static EventHandler<PTRRefreshEvent> getPTRRefreshEventHandler(ComponentContext context)
public static EventHandler<PTRRefreshEvent> onRefresh(ComponentContext c, SectionTree sectionTree)
protected java.lang.Object dispatchOnEventImpl(EventHandler eventHandler, java.lang.Object eventState)
dispatchOnEventImpl
in class Component
@Deprecated public static EventTrigger<ScrollEvent> onScrollTrigger(ComponentContext c, java.lang.String key)
#onScroll(ComponentContext, Handle)
.@Deprecated public static EventTrigger<RecyclerDynamicConfigEvent> onRecyclerConfigChangedTrigger(ComponentContext c, java.lang.String key)
#onRecyclerConfigChanged(ComponentContext, Handle)
.@Deprecated public static EventTrigger<ClearRefreshingEvent> onClearRefreshingTrigger(ComponentContext c, java.lang.String key)
onClearRefreshing(ComponentContext, Handle)
.public static void onScroll(ComponentContext c, Handle handle, int position, boolean animate)
@Deprecated public static void onScroll(ComponentContext c, java.lang.String key, int position, boolean animate)
#onScroll(ComponentContext, Handle)
instead.@Deprecated public static void onScroll(EventTrigger trigger, int position, boolean animate)
#onScroll(ComponentContext, Handle)
instead.public static void onRecyclerConfigChanged(ComponentContext c, Handle handle, int commitPolicy)
@Deprecated public static void onRecyclerConfigChanged(ComponentContext c, java.lang.String key, int commitPolicy)
#onRecyclerConfigChanged(ComponentContext, Handle)
instead.@Deprecated public static void onRecyclerConfigChanged(EventTrigger trigger, int commitPolicy)
#onRecyclerConfigChanged(ComponentContext, Handle)
instead.public static void onClearRefreshing(ComponentContext c, Handle handle)
@Deprecated public static void onClearRefreshing(ComponentContext c, java.lang.String key)
onClearRefreshing(ComponentContext, Handle)
instead.@Deprecated public static void onClearRefreshing(EventTrigger trigger)
onClearRefreshing(ComponentContext, Handle)
instead.protected java.lang.Object acceptTriggerEventImpl(EventTrigger eventTrigger, java.lang.Object eventState, java.lang.Object[] params)
acceptTriggerEventImpl
in class SpecGeneratedComponent
public void recordEventTrigger(ComponentContext c, EventTriggersContainer container)
recordEventTrigger
in interface HasEventTrigger
recordEventTrigger
in class SpecGeneratedComponent
protected boolean hasState()
hasState
in class SpecGeneratedComponent
protected void transferState(StateContainer _prevStateContainer, StateContainer _nextStateContainer)
Component
transferState
in class Component
protected static void updateLoadingState(ComponentContext c, RecyclerCollectionComponentSpec.LoadingState currentLoadingState)
protected static void updateLoadingStateAsync(ComponentContext c, RecyclerCollectionComponentSpec.LoadingState currentLoadingState)
protected static void updateLoadingStateSync(ComponentContext c, RecyclerCollectionComponentSpec.LoadingState currentLoadingState)
protected static void lazyUpdateHasSetSectionTreeRoot(ComponentContext c, boolean lazyUpdateValue)
public static RecyclerCollectionComponent.Builder create(ComponentContext context)
public static RecyclerCollectionComponent.Builder create(ComponentContext context, int defStyleAttr, int defStyleRes)