public abstract class SectionLifecycle extends Object implements EventDispatcher, EventTriggerTarget
Modifier and Type | Class and Description |
---|---|
protected static interface |
SectionLifecycle.StateContainer |
protected static interface |
SectionLifecycle.StateUpdate |
Constructor and Description |
---|
SectionLifecycle() |
Modifier and Type | Method and Description |
---|---|
Object |
acceptTriggerEvent(EventTrigger eventTrigger,
Object eventState,
Object[] params) |
protected <T> Diff<T> |
acquireDiff(T previousValue,
T nextValue) |
protected Output |
acquireOutput() |
protected void |
bindService(SectionContext c) |
protected Children |
createChildren(SectionContext c)
This methods will delegate to the
GroupSectionSpec
method annotated with com.facebook.litho.sections.annotations.OnCreateChildren |
protected void |
createInitialState(SectionContext c) |
protected void |
createService(SectionContext c) |
protected void |
dataBound(SectionContext c)
This method will delegate to the
Section Spec method annotated with OnDataBound |
protected void |
dataRendered(SectionContext c,
boolean isDataChanged,
boolean isMounted)
This method will delegate to the
Section Spec method annotated with OnDataRendered . |
static void |
dispatchLoadingEvent(SectionContext context,
boolean isEmpty,
LoadingEvent.LoadingState loadingState,
Throwable t) |
Object |
dispatchOnEvent(EventHandler eventHandler,
Object eventState) |
protected void |
generateChangeSet(SectionContext c,
ChangeSet changeSet,
Section previous,
Section next)
This method will delegate to the
DiffSectionSpec
method annotated with OnDiff |
protected static EventTrigger |
getEventTrigger(SectionContext c,
int id,
String key) |
static EventHandler |
getLoadingEventHandler(SectionContext context) |
protected Object |
getService(Section section) |
protected TreeProps |
getTreePropsForChildren(SectionContext c,
TreeProps previousTreeProps)
Updates the TreeProps map with outputs from all
OnCreateTreeProp methods. |
protected boolean |
isDiffSectionSpec() |
protected static <E> EventHandler<E> |
newEventHandler(SectionContext c,
int id,
Object[] params) |
protected static <E> EventHandler<E> |
newEventHandler(Section c,
int id,
Object[] params) |
protected static <E> EventTrigger<E> |
newEventTrigger(SectionContext c,
String childKey,
int id) |
protected void |
populateTreeProps(TreeProps parentTreeProps)
Retrieves all of the tree props used by this Section from the TreeProps map
and sets the tree props as fields on the ComponentImpl.
|
protected void |
refresh(SectionContext sectionContext) |
protected void |
releaseDiff(Diff diff) |
protected void |
releaseOutput(Output output) |
static void |
requestFocus(SectionContext c,
int index)
Scroll to the index of the section.
|
static void |
requestFocus(SectionContext c,
String sectionKey)
Scroll to the beginning of the section with the given key.
|
static void |
requestFocus(SectionContext c,
String sectionKey,
FocusType focusType)
Scroll to the index in the section with the given key.
|
static void |
requestFocusWithOffset(SectionContext c,
int index,
int offset)
Scroll to the index in the section with an additional offset.
|
static void |
requestFocusWithOffset(SectionContext c,
String sectionKey,
int offset)
Scroll to the beginning of the section with the given key and an additional offset.
|
static void |
requestFocusWithOffset(SectionContext c,
String sectionKey,
int index,
int offset)
Scroll to the index in the section with the given key and an additional offset.
|
static void |
requestSmoothFocus(SectionContext c,
int index) |
static void |
requestSmoothFocus(SectionContext c,
int index,
SmoothScrollAlignmentType type) |
static void |
requestSmoothFocus(SectionContext c,
String keyString,
int index,
int offset,
SmoothScrollAlignmentType type) |
protected boolean |
shouldUpdate(Section previous,
Section next) |
protected void |
transferService(SectionContext c,
Section oldSection,
Section newSection)
Call this to transfer the Services between two
Section with the same global scope. |
protected void |
transferState(SectionContext c,
SectionLifecycle.StateContainer stateContainer)
|
protected void |
unbindService(SectionContext c) |
protected void |
viewportChanged(SectionContext sectionContext,
int firstVisibleItem,
int lastVisibleItem,
int totalItemsCount,
int firstFullyVisibleItem,
int lastFullyVisibleItem) |
protected Children createChildren(SectionContext c)
GroupSectionSpec
method annotated with com.facebook.litho.sections.annotations.OnCreateChildren
protected void generateChangeSet(SectionContext c, ChangeSet changeSet, Section previous, Section next)
DiffSectionSpec
method annotated with OnDiff
protected void dataBound(SectionContext c)
Section
Spec method annotated with OnDataBound
protected void dataRendered(SectionContext c, boolean isDataChanged, boolean isMounted)
Section
Spec method annotated with OnDataRendered
.protected void bindService(SectionContext c)
protected void unbindService(SectionContext c)
protected void createInitialState(SectionContext c)
protected void createService(SectionContext c)
public Object dispatchOnEvent(EventHandler eventHandler, Object eventState)
dispatchOnEvent
in interface EventDispatcher
@Nullable public Object acceptTriggerEvent(EventTrigger eventTrigger, Object eventState, Object[] params)
acceptTriggerEvent
in interface EventTriggerTarget
protected void viewportChanged(SectionContext sectionContext, int firstVisibleItem, int lastVisibleItem, int totalItemsCount, int firstFullyVisibleItem, int lastFullyVisibleItem)
protected void refresh(SectionContext sectionContext)
protected void transferState(SectionContext c, SectionLifecycle.StateContainer stateContainer)
protected void transferService(SectionContext c, Section oldSection, Section newSection)
Section
with the same global scope.protected final <T> Diff<T> acquireDiff(T previousValue, T nextValue)
protected void releaseDiff(Diff diff)
protected Output acquireOutput()
protected void releaseOutput(Output output)
protected boolean isDiffSectionSpec()
protected static <E> EventHandler<E> newEventHandler(SectionContext c, int id, Object[] params)
protected static <E> EventHandler<E> newEventHandler(Section c, int id, Object[] params)
protected static <E> EventTrigger<E> newEventTrigger(SectionContext c, String childKey, int id)
@Nullable protected static EventTrigger getEventTrigger(SectionContext c, int id, String key)
protected void populateTreeProps(TreeProps parentTreeProps)
protected TreeProps getTreePropsForChildren(SectionContext c, TreeProps previousTreeProps)
OnCreateTreeProp
methods.public static EventHandler getLoadingEventHandler(SectionContext context)
public static void dispatchLoadingEvent(SectionContext context, boolean isEmpty, LoadingEvent.LoadingState loadingState, @Nullable Throwable t)
public static void requestFocus(SectionContext c, int index)
public static void requestFocus(SectionContext c, String sectionKey)
public static void requestFocus(SectionContext c, String sectionKey, FocusType focusType)
public static void requestFocusWithOffset(SectionContext c, int index, int offset)
requestFocus(SectionContext, int)
API is that this will *always* take an
action, while requestFocus(SectionContext, int)
will ignore the command if the item is
visible on the screen.offset
- distance, in pixels, from the top of the screen to scroll the requested itempublic static void requestFocusWithOffset(SectionContext c, String sectionKey, int offset)
requestFocus(SectionContext, String)
API is that this
will *always* take an action, while requestFocus(SectionContext, String)
will ignore
the command if the item is visible on the screen.sectionKey
- the key of the section component.offset
- distance, in pixels, from the top of the screen to scroll the requested item.public static void requestFocusWithOffset(SectionContext c, String sectionKey, int index, int offset)
requestFocus(SectionContext, String)
API is that this
will *always* take an action, while requestFocus(SectionContext, String)
will ignore
the command if the item is visible on the screen.sectionKey
- the key of the section component.index
- the index the section componentoffset
- distance, in pixels, from the top of the screen to scroll the requested item.public static void requestSmoothFocus(SectionContext c, int index)
public static void requestSmoothFocus(SectionContext c, int index, SmoothScrollAlignmentType type)
public static void requestSmoothFocus(SectionContext c, String keyString, int index, int offset, SmoothScrollAlignmentType type)