public class TransitionManager extends Object
Scene
. To use the manager, add scenes along with
transition objects with calls to setTransition(Scene, Transition)
or setTransition(Scene, Scene, Transition)
. Setting specific
transitions for scene changes is not required; by default, a Scene change
will use AutoTransition
to do something reasonable for most
situations. Specifying other transitions for particular scene changes is
only necessary if the application wants different transition behavior
in these situations.
Unlike the platform version, this does not support declaration by XML resources.
Constructor and Description |
---|
TransitionManager() |
Modifier and Type | Method and Description |
---|---|
static void |
beginDelayedTransition(ViewGroup sceneRoot)
Convenience method to animate, using the default transition,
to a new scene defined by all changes within the given scene root between
calling this method and the next rendering frame.
|
static void |
beginDelayedTransition(ViewGroup sceneRoot,
Transition transition)
Convenience method to animate to a new scene defined by all changes within
the given scene root between calling this method and the next rendering frame.
|
static void |
go(Scene scene)
Convenience method to simply change to the given scene using
the default transition for TransitionManager.
|
static void |
go(Scene scene,
Transition transition)
Convenience method to simply change to the given scene using
the given transition.
|
void |
setTransition(Scene fromScene,
Scene toScene,
Transition transition)
Sets a specific transition to occur when the given pair of scenes is
exited/entered.
|
void |
setTransition(Scene scene,
Transition transition)
Sets a specific transition to occur when the given scene is entered.
|
void |
transitionTo(Scene scene)
Change to the given scene, using the
appropriate transition for this particular scene change
(as specified to the TransitionManager, or the default
if no such transition exists).
|
public static void go(@NonNull Scene scene)
scene
- The Scene to change topublic static void go(@NonNull Scene scene, @Nullable Transition transition)
Passing in null
for the transition parameter will
result in the scene changing without any transition running, and is
equivalent to calling Scene.exit()
on the scene root's
current scene, followed by Scene.enter()
on the scene
specified by the scene
parameter.
scene
- The Scene to change totransition
- The transition to use for this scene change. A
value of null causes the scene change to happen with no transition.public static void beginDelayedTransition(@NonNull ViewGroup sceneRoot)
beginDelayedTransition(ViewGroup, Transition)
with a value of null
for the transition
parameter.sceneRoot
- The root of the View hierarchy to run the transition on.public static void beginDelayedTransition(@NonNull ViewGroup sceneRoot, @Nullable Transition transition)
Calling this method several times before the next frame (for example, if unrelated code also wants to make dynamic changes and run a transition on the same scene root), only the first call will trigger capturing values and exiting the current scene. Subsequent calls to the method with the same scene root during the same frame will be ignored.
Passing in null
for the transition parameter will
cause the TransitionManager to use its default transition.
sceneRoot
- The root of the View hierarchy to run the transition on.transition
- The transition to use for this change. A
value of null causes the TransitionManager to use the default transition.public void setTransition(@NonNull Scene scene, @Nullable Transition transition)
scene
- The scene which, when applied, will cause the given
transition to run.transition
- The transition that will play when the given scene is
entered. A value of null will result in the default behavior of
using the default transition instead.public void setTransition(@NonNull Scene fromScene, @NonNull Scene toScene, @Nullable Transition transition)
fromScene
- The scene being exited when the given transition will
be runtoScene
- The scene being entered when the given transition will
be runtransition
- The transition that will play when the given scene is
entered. A value of null will result in the default behavior of
using the default transition instead.