summaryrefslogtreecommitdiffstats
path: root/core/java/android/transition
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2015-02-02 11:27:21 -0800
committerAlan Viverette <alanv@google.com>2015-02-02 11:27:21 -0800
commite025ed2f26858dae5f40a94a2e1ac0db808a6950 (patch)
tree852f4f6c92811eb22469bf083379cbf7ae8d6177 /core/java/android/transition
parent84183103f4a9222ddbe22c7289f9627c74892d53 (diff)
downloadframeworks_base-e025ed2f26858dae5f40a94a2e1ac0db808a6950.zip
frameworks_base-e025ed2f26858dae5f40a94a2e1ac0db808a6950.tar.gz
frameworks_base-e025ed2f26858dae5f40a94a2e1ac0db808a6950.tar.bz2
Make popup transition animation play nicely with dismiss/show pair
Previously it was okay to call dismiss/show in quick succession since the window was removed synchronously. Adding transitions introduced a delay between dismiss() and actually removing the window, which broke this behavior. Change-Id: I0de8ae0a551dcb2eb8b8a50356c308b654ebdc6f
Diffstat (limited to 'core/java/android/transition')
-rw-r--r--core/java/android/transition/TransitionManager.java27
1 files changed, 26 insertions, 1 deletions
diff --git a/core/java/android/transition/TransitionManager.java b/core/java/android/transition/TransitionManager.java
index 7bd6287..80245ef 100644
--- a/core/java/android/transition/TransitionManager.java
+++ b/core/java/android/transition/TransitionManager.java
@@ -268,7 +268,12 @@ public class TransitionManager {
@Override
public boolean onPreDraw() {
removeListeners();
- sPendingTransitions.remove(mSceneRoot);
+
+ // Don't start the transition if it's no longer pending.
+ if (!sPendingTransitions.remove(mSceneRoot)) {
+ return true;
+ }
+
// Add to running list, handle end to remove it
final ArrayMap<ViewGroup, ArrayList<Transition>> runningTransitions =
getRunningTransitions();
@@ -417,4 +422,24 @@ public class TransitionManager {
sceneChangeRunTransition(sceneRoot, transitionClone);
}
}
+
+ /**
+ * Ends all pending and ongoing transitions on the specified scene root.
+ *
+ * @param sceneRoot The root of the View hierarchy to end transitions on.
+ * @hide
+ */
+ public static void endTransitions(final ViewGroup sceneRoot) {
+ sPendingTransitions.remove(sceneRoot);
+
+ final ArrayList<Transition> runningTransitions = getRunningTransitions().get(sceneRoot);
+ if (runningTransitions != null) {
+ final int count = runningTransitions.size();
+ for (int i = 0; i < count; i++) {
+ final Transition transition = runningTransitions.get(i);
+ transition.end();
+ }
+ }
+
+ }
}