public abstract class SectionLifecycle extends Object implements EventDispatcher
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 |
---|---|
protected <T> Diff<T> |
acquireDiff(T previousValue,
T nextValue) |
protected Output |
acquireOutput() |
protected void |
bindService(SectionContext c,
Section section) |
protected Children |
createChildren(SectionContext c,
Section component)
This methods will delegate to the
GroupSectionSpec
method annotated with com.facebook.litho.sections.annotations.OnCreateChildren |
protected void |
createInitialState(SectionContext c,
Section section) |
protected void |
createService(SectionContext c,
Section section) |
protected void |
dataBound(SectionContext c,
Section section)
This method will delegate to the
Section Spec method annotated with OnDataBound |
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 |
static EventHandler |
getLoadingEventHandler(SectionContext context) |
protected Object |
getService(Section section) |
protected TreeProps |
getTreePropsForChildren(SectionContext c,
Section section,
TreeProps previousTreeProps)
Updates the TreeProps map with outputs from all
OnCreateTreeProp methods. |
protected boolean |
isDiffSectionSpec() |
protected static <E> EventHandler<E> |
newEventHandler(Section<?> c,
String name,
int id,
Object[] params) |
protected static <E> EventHandler<E> |
newEventHandler(SectionContext c,
String name,
int id,
Object[] params) |
protected void |
populateTreeProps(Section section,
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,
Section section) |
protected void |
releaseDiff(Diff diff) |
protected void |
releaseOutput(Output output) |
static void |
requestFocus(SectionContext c,
int index) |
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) |
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 index in the section with an additional offset.
|
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,
Section section)
|
protected void |
unbindService(SectionContext c,
Section section) |
protected void |
viewportChanged(SectionContext sectionContext,
int firstVisibleItem,
int lastVisibleItem,
int totalItemsCount,
int firstFullyVisibleItem,
int lastFullyVisibleItem,
Section section) |
protected Children createChildren(SectionContext c, Section component)
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 section)
Section
Spec method annotated with OnDataBound
protected void bindService(SectionContext c, Section section)
protected void unbindService(SectionContext c, Section section)
protected void createInitialState(SectionContext c, Section section)
protected void createService(SectionContext c, Section section)
public Object dispatchOnEvent(EventHandler eventHandler, Object eventState)
dispatchOnEvent
in interface EventDispatcher
protected void viewportChanged(SectionContext sectionContext, int firstVisibleItem, int lastVisibleItem, int totalItemsCount, int firstFullyVisibleItem, int lastFullyVisibleItem, Section section)
protected void refresh(SectionContext sectionContext, Section section)
protected void transferState(SectionContext c, SectionLifecycle.StateContainer stateContainer, Section section)
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, String name, int id, Object[] params)
protected static <E> EventHandler<E> newEventHandler(Section<?> c, String name, int id, Object[] params)
protected void populateTreeProps(Section section, TreeProps parentTreeProps)
protected TreeProps getTreePropsForChildren(SectionContext c, Section section, TreeProps previousTreeProps)
OnCreateTreeProp
methods.public static EventHandler getLoadingEventHandler(SectionContext context)
public static void dispatchLoadingEvent(SectionContext context, boolean isEmpty, LoadingEvent.LoadingState loadingState, Throwable t)
public static void requestFocus(SectionContext c, int index)
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 requestFocus(SectionContext c, String sectionKey)
public 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.offset
- distance, in pixels, from the top of the screen to scroll the requested itempublic static void requestFocus(SectionContext c, String sectionKey, FocusType focusType)