From 61158c621d0834d6d4e1e0310596d9b7a1071178 Mon Sep 17 00:00:00 2001 From: Chet Haase Date: Tue, 6 Sep 2011 22:19:45 -0700 Subject: [PATCH] Fix issue with LayoutTransition on non-visible windows. There's a problem with how LayoutTransition cleans up after itself when the target view is in a Window that is not on the screen. The quick fix is to always start (and therefore properly end and clear) transitions, regardless of whether the window is in the tree. Change-Id: I23f4f4f04176f3943e5c6e1d78acba0190a96930 --- core/java/android/view/ViewRootImpl.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 0d160a94c4091..2a4b8ce9e714f 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -1564,13 +1564,13 @@ public final class ViewRootImpl extends Handler implements ViewParent, boolean cancelDraw = attachInfo.mTreeObserver.dispatchOnPreDraw() || viewVisibility != View.VISIBLE; - if (!cancelDraw && !newSurface) { - if (mPendingTransitions != null && mPendingTransitions.size() > 0) { - for (int i = 0; i < mPendingTransitions.size(); ++i) { - mPendingTransitions.get(i).startChangingAnimations(); - } - mPendingTransitions.clear(); + if (mPendingTransitions != null && mPendingTransitions.size() > 0) { + for (int i = 0; i < mPendingTransitions.size(); ++i) { + mPendingTransitions.get(i).startChangingAnimations(); } + mPendingTransitions.clear(); + } + if (!cancelDraw && !newSurface) { mFullRedrawNeeded = false; final long drawStartTime; @@ -1608,10 +1608,6 @@ public final class ViewRootImpl extends Handler implements ViewParent, } } } else { - // If we're not drawing, then we don't need to draw the transitions, either - if (mPendingTransitions != null) { - mPendingTransitions.clear(); - } // We were supposed to report when we are done drawing. Since we canceled the // draw, remember it here. @@ -1621,7 +1617,7 @@ public final class ViewRootImpl extends Handler implements ViewParent, if (fullRedrawNeeded) { mFullRedrawNeeded = true; } - + if (viewVisibility == View.VISIBLE) { // Try again scheduleTraversals();