public final class Scene extends Object
Constructor and Description |
---|
Scene(ViewGroup sceneRoot)
Constructs a Scene with no information about how values will change
when this scene is applied.
|
Scene(ViewGroup sceneRoot,
View layout)
Constructs a Scene which, when entered, will remove any
children from the sceneRoot container and add the layout
object as a new child of that container.
|
Scene(ViewGroup sceneRoot,
ViewGroup layout)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
enter()
Enters this scene, which entails changing all values that
are specified by this scene.
|
void |
exit()
Exits this scene, if it is the current scene
on the scene's
scene root . |
static Scene |
getSceneForLayout(ViewGroup sceneRoot,
int layoutId,
Context context)
Returns a Scene described by the resource file associated with the given
layoutId parameter. |
ViewGroup |
getSceneRoot()
Gets the root of the scene, which is the root of the view hierarchy
affected by changes due to this scene, and which will be animated
when this scene is entered.
|
void |
setEnterAction(Runnable action)
Scenes that are not defined with layout resources or
hierarchies, or which need to perform additional steps
after those hierarchies are changed to, should set an enter
action, and possibly an exit action as well.
|
void |
setExitAction(Runnable action)
Scenes that are not defined with layout resources or
hierarchies, or which need to perform additional steps
after those hierarchies are changed to, should set an enter
action, and possibly an exit action as well.
|
public Scene(ViewGroup sceneRoot)
setEnterAction(Runnable)
and possibly
setExitAction(Runnable)
.sceneRoot
- The root of the hierarchy in which scene changes
and transitions will take place.public Scene(ViewGroup sceneRoot, View layout)
sceneRoot
- The root of the hierarchy in which scene changes
and transitions will take place.layout
- The view hierarchy of this scene, added as a child
of sceneRoot when this scene is entered.@Deprecated public Scene(ViewGroup sceneRoot, ViewGroup layout)
Scene(ViewGroup, View)
.public static Scene getSceneForLayout(ViewGroup sceneRoot, int layoutId, Context context)
layoutId
parameter. If such a Scene has already been created for
the given sceneRoot
, that same Scene will be returned.
This caching of layoutId-based scenes enables sharing of common scenes
between those created in code and those referenced by TransitionManager
XML resource files.sceneRoot
- The root of the hierarchy in which scene changes
and transitions will take place.layoutId
- The id of a standard layout resource file.context
- The context used in the process of inflating
the layout resource.public ViewGroup getSceneRoot()
public void exit()
scene root
. The current scene is
set when entering
a scene.
Exiting a scene runs the exit action
if there is one.public void enter()
setEnterAction(Runnable)
enter action}, or a
combination of the these. No transition will be run when the
scene is entered. To get transition behavior in scene changes,
use one of the methods in TransitionManager
instead.public void setEnterAction(Runnable action)
action
- The runnable whose run()
method will
be called when this scene is enteredsetExitAction(Runnable)
,
Scene(ViewGroup, int, Context)
,
Scene(ViewGroup, ViewGroup)
public void setExitAction(Runnable action)
setEnterAction(Runnable)
if an enter action is set.