public class SectionTree extends 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.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() |
boolean |
isReleased() |
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 |
setLoadEventsHandler(LoadEventsHandler loadEventsHandler)
|
void |
setRoot(Section section)
Update the root Section.
|
void |
setRootAsync(Section section)
Update the root Section.
|
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)
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 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 release()
public boolean isReleased()
public static Looper getDefaultChangeSetThreadLooper()