Home | History | Annotate | Download | only in transition

Lines Matching refs:Transition

17 package android.transition;
32 * transition objects with calls to {@link #setTransition(Scene, Transition)}
33 * or {@link #setTransition(Scene, Scene, Transition)}. Setting specific
37 * only necessary if the application wants different transition behavior
41 * <code>res/transition</code> directory. TransitionManager resources consist of
43 * <code>transition</code> tags, each of which describe the relationship of
44 * that transition to the from/to scene information in that tag.
48 * {@sample development/samples/ApiDemos/res/transition/transitions_mgr.xml TransitionManager}
54 * <code>transition</code> attribute, there is a reference to a resource
55 * file in the <code>res/transition</code> directory which describes that
56 * transition.</p>
59 * {@link android.R.styleable#Transition}, {@link android.R.styleable#TransitionSet},
68 private static Transition sDefaultTransition = new AutoTransition();
72 ArrayMap<Scene, Transition> mSceneTransitions = new ArrayMap<Scene, Transition>();
73 ArrayMap<Scene, ArrayMap<Scene, Transition>> mScenePairTransitions =
74 new ArrayMap<Scene, ArrayMap<Scene, Transition>>();
75 private static ThreadLocal<WeakReference<ArrayMap<ViewGroup, ArrayList<Transition>>>>
77 new ThreadLocal<WeakReference<ArrayMap<ViewGroup, ArrayList<Transition>>>>();
82 * Sets the transition to be used for any scene change for which no
83 * other transition is explicitly set. The initial value is
86 * @param transition The default transition to be used for scene changes.
90 public void setDefaultTransition(Transition transition) {
91 sDefaultTransition = transition;
95 * Gets the current default transition. The initial value is an {@link
98 * @return The current default transition.
99 * @see #setDefaultTransition(Transition)
103 public static Transition getDefaultTransition() {
108 * Sets a specific transition to occur when the given scene is entered.
111 * transition to run.
112 * @param transition The transition that will play when the given scene is
114 * using the default transition instead.
116 public void setTransition(Scene scene, Transition transition) {
117 mSceneTransitions.put(scene, transition);
121 * Sets a specific transition to occur when the given pair of scenes is
124 * @param fromScene The scene being exited when the given transition will
126 * @param toScene The scene being entered when the given transition will
128 * @param transition The transition that will play when the given scene is
130 * using the default transition instead.
132 public void setTransition(Scene fromScene, Scene toScene, Transition transition) {
133 ArrayMap<Scene, Transition> sceneTransitionMap = mScenePairTransitions.get(toScene);
135 sceneTransitionMap = new ArrayMap<Scene, Transition>();
138 sceneTransitionMap.put(fromScene, transition);
142 * Returns the Transition for the given scene being entered. The result
147 * @return The Transition to be used for the given scene change. If no
148 * Transition was specified for this scene change, the default transition
151 private Transition getTransition(Scene scene) {
152 Transition transition = null;
158 ArrayMap<Scene, Transition> sceneTransitionMap = mScenePairTransitions.get(scene);
160 transition = sceneTransitionMap.get(currScene);
161 if (transition != null) {
162 return transition;
167 transition = mSceneTransitions.get(scene);
168 return (transition != null) ? transition : sDefaultTransition;
172 * This is where all of the work of a transition/scene-change is
174 * transition, exits the current Scene, enters the new scene, captures
175 * the end values for the transition, and finally plays the
176 * resulting values-populated transition.
179 * @param transition The transition to play for this scene change
181 private static void changeScene(Scene scene, Transition transition) {
187 Transition transitionClone = null;
188 if (transition != null) {
189 transitionClone = transition.clone();
207 private static ArrayMap<ViewGroup, ArrayList<Transition>> getRunningTransitions() {
208 WeakReference<ArrayMap<ViewGroup, ArrayList<Transition>>> runningTransitions =
211 ArrayMap<ViewGroup, ArrayList<Transition>> transitions =
212 new ArrayMap<ViewGroup, ArrayList<Transition>>();
213 runningTransitions = new WeakReference<ArrayMap<ViewGroup, ArrayList<Transition>>>(
221 final Transition transition) {
222 if (transition != null && sceneRoot != null) {
223 MultiListener listener = new MultiListener(transition, sceneRoot);
232 * about since that's what triggers the transition to take place.
240 Transition mTransition;
243 MultiListener(Transition transition, ViewGroup sceneRoot) {
244 mTransition = transition;
262 ArrayList<Transition> runningTransitions = getRunningTransitions().get(mSceneRoot);
264 for (Transition runningTransition : runningTransitions) {
275 // Don't start the transition if it's no longer pending.
281 final ArrayMap<ViewGroup, ArrayList<Transition>> runningTransitions =
283 ArrayList<Transition> currentTransitions = runningTransitions.get(mSceneRoot);
284 ArrayList<Transition> previousRunningTransitions = null;
286 currentTransitions = new ArrayList<Transition>();
289 previousRunningTransitions = new ArrayList<Transition>(currentTransitions);
292 mTransition.addListener(new Transition.TransitionListenerAdapter() {
294 public void onTransitionEnd(Transition transition) {
295 ArrayList<Transition> currentTransitions =
297 currentTransitions.remove(transition);
302 for (Transition runningTransition : previousRunningTransitions) {
312 private static void sceneChangeSetup(ViewGroup sceneRoot, Transition transition) {
315 ArrayList<Transition> runningTransitions = getRunningTransitions().get(sceneRoot);
318 for (Transition runningTransition : runningTransitions) {
323 if (transition != null) {
324 transition.captureValues(sceneRoot, true);
336 * appropriate transition for this particular scene change
338 * if no such transition exists).
343 // Auto transition if there is no transition declared for the Scene, but there is
350 * the default transition for TransitionManager.
360 * the given transition.
362 * <p>Passing in <code>null</code> for the transition parameter will
363 * result in the scene changing without any transition running, and is
369 * @param transition The transition to use for this scene change. A
370 * value of null causes the scene change to happen with no transition.
372 public static void go(Scene scene, Transition transition) {
373 changeScene(scene, transition);
377 * Convenience method to animate, using the default transition,
380 * Equivalent to calling {@link #beginDelayedTransition(ViewGroup, Transition)}
381 * with a value of <code>null</code> for the <code>transition</code> parameter.
383 * @param sceneRoot The root of the View hierarchy to run the transition on.
393 * scene root and then post a request to run a transition on the next frame.
397 * the transition begins.
400 * unrelated code also wants to make dynamic changes and run a transition on
405 * <p>Passing in <code>null</code> for the transition parameter will
406 * cause the TransitionManager to use its default transition.</p>
408 * @param sceneRoot The root of the View hierarchy to run the transition on.
409 * @param transition The transition to use for this change. A
410 * value of null causes the TransitionManager to use the default transition.
412 public static void beginDelayedTransition(final ViewGroup sceneRoot, Transition transition) {
414 if (Transition.DBG) {
415 Log.d(LOG_TAG, "beginDelayedTransition: root, transition = " +
416 sceneRoot + ", " + transition);
419 if (transition == null) {
420 transition = sDefaultTransition;
422 final Transition transitionClone = transition.clone();
437 final ArrayList<Transition> runningTransitions = getRunningTransitions().get(sceneRoot);
440 ArrayList<Transition> copy = new ArrayList(runningTransitions);
442 final Transition transition = copy.get(i);
443 transition.forceToEnd(sceneRoot);