diff options
author | Chet Haase <chet@google.com> | 2010-09-08 16:36:57 -0700 |
---|---|---|
committer | Chet Haase <chet@google.com> | 2010-09-08 17:17:25 -0700 |
commit | 634a20acf713ffe0d4a67c0b888cf1e9782890e7 (patch) | |
tree | 138c49af7cdfd654ba2668cff390a4159643c201 /core | |
parent | 414e7f761e27060fa23f96a369922443e4ae2676 (diff) | |
download | frameworks_base-634a20acf713ffe0d4a67c0b888cf1e9782890e7.zip frameworks_base-634a20acf713ffe0d4a67c0b888cf1e9782890e7.tar.gz frameworks_base-634a20acf713ffe0d4a67c0b888cf1e9782890e7.tar.bz2 |
Fix bug with LayoutTransition when layouts are just coming on line
Change-Id: Ia7061d8ec138f8f7aea822596f46b3549a996700
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/animation/LayoutTransition.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/java/android/animation/LayoutTransition.java b/core/java/android/animation/LayoutTransition.java index d1bc9bd..69ad67e 100644 --- a/core/java/android/animation/LayoutTransition.java +++ b/core/java/android/animation/LayoutTransition.java @@ -520,6 +520,10 @@ public class LayoutTransition { staggerDelay = 0; final ViewTreeObserver observer = parent.getViewTreeObserver(); // used for later cleanup + if (!observer.isAlive()) { + // If the observer's not in a good state, skip the transition + return; + } int numChildren = parent.getChildCount(); for (int i = 0; i < numChildren; ++i) { @@ -607,7 +611,7 @@ public class LayoutTransition { // layout listeners. observer.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { public boolean onPreDraw() { - observer.removeOnPreDrawListener(this); + parent.getViewTreeObserver().removeOnPreDrawListener(this); int numChildren = parent.getChildCount(); for (int i = 0; i < numChildren; ++i) { final View child = parent.getChildAt(i); |