public class SectionTree
extends java.lang.Object
Section
and manages their lifecycle. SectionTree
takes a
root Section
and generates the complete tree by recursively invoking OnCreateChildren.
SectionTree
is also responsible for regenerating the tree in response to state update
events.Modifier and Type | Class and Description |
---|---|
static class |
SectionTree.Builder
A builder class that can be used to create a
SectionTree . |
static interface |
SectionTree.SectionMatcher |
static interface |
SectionTree.Target
The class implementing this interface will be responsible to translate the ChangeSet into UI
updates.
|
Modifier and Type | Method and Description |
---|---|
static SectionTree.Builder |
create(SectionContext context,
SectionTree.Target target)
Create a
SectionTree.Builder that can be used to configure a SectionTree . |
static Looper |
getDefaultChangeSetThreadLooper() |
int |
getIndexForMatcher(SectionTree.SectionMatcher sectionMatcher) |
boolean |
isReleased() |
boolean |
isSectionIndexValid(java.lang.String globalKey,
int index) |
void |
refresh()
Asks all the
Section in the tree to refresh themselves. |
void |
release()
Call this when to release this SectionTree and make sure that all the Services in the tree get
destroyed.
|
void |
requestFocusOnRoot(int index) |
void |
requestFocusOnRoot(int index,
int offset) |
void |
requestFocusOnRoot(java.lang.Object id,
int offset) |
void |
requestSmoothFocusOnRoot(int index,
int offset,
SmoothScrollAlignmentType type) |
void |
requestSmoothFocusOnRoot(java.lang.Object id,
int offset,
SmoothScrollAlignmentType type) |
void |
setLoadEventsHandler(LoadEventsHandler loadEventsHandler)
|
void |
setRoot(Section section)
Update the root Section.
|
void |
setRootAsync(Section section)
Update the root Section.
|
void |
setTargetConfig(SectionTree.Target.DynamicConfig dynamicConfig)
Set a new set of configurations to the
SectionTree.Target . |
void |
viewPortChanged(int firstVisibleIndex,
int lastVisibleIndex,
int firstFullyVisibleIndex,
int lastFullyVisibleIndex,
int state) |
void |
viewPortChangedFromScrolling(int firstVisibleIndex,
int lastVisibleIndex,
int firstFullyVisibleIndex,
int lastFullyVisibleIndex) |
public static SectionTree.Builder create(SectionContext context, SectionTree.Target target)
SectionTree.Builder
that can be used to configure a SectionTree
.context
- The SectionContext
taht will be used to create the child Component
starget
- The SectionTree.Target
that will be responsible to apply the ChangeSet
to the
UI.public void setRoot(Section section)
ChangeSet
to be applied to the UI. In response to this Target#applyNewChangeSet(int)
()} will be
invoked once the ChangeSet
has been calculated. The generation of the ChangeSet will
happen synchronously in the thread calling this method.section
- The new root.public void setRootAsync(Section section)
ChangeSet
to be applied to the UI. In response to this Target#applyNewChangeSet(int, String,
Throwable)
will be invoked once the ChangeSet
has been calculated. The generation of
the ChangeSet will happen asynchronously in this SectionTree ChangeSetThread.section
- The new root.public void refresh()
public void setLoadEventsHandler(LoadEventsHandler loadEventsHandler)
public void setTargetConfig(SectionTree.Target.DynamicConfig dynamicConfig)
SectionTree.Target
. Only those allowed to be modified will
be included in SectionTree.Target.DynamicConfig
.public void viewPortChangedFromScrolling(int firstVisibleIndex, int lastVisibleIndex, int firstFullyVisibleIndex, int lastFullyVisibleIndex)
public void viewPortChanged(int firstVisibleIndex, int lastVisibleIndex, int firstFullyVisibleIndex, int lastFullyVisibleIndex, int state)
public void requestFocusOnRoot(int index)
public void requestFocusOnRoot(int index, int offset)
public void requestFocusOnRoot(java.lang.Object id, int offset)
public int getIndexForMatcher(SectionTree.SectionMatcher sectionMatcher)
public void requestSmoothFocusOnRoot(int index, int offset, SmoothScrollAlignmentType type)
public void requestSmoothFocusOnRoot(java.lang.Object id, int offset, SmoothScrollAlignmentType type)
public boolean isSectionIndexValid(java.lang.String globalKey, int index)
public void release()
public boolean isReleased()
public static Looper getDefaultChangeSetThreadLooper()