diff options
author | Chet Haase <chet@google.com> | 2013-08-21 14:01:02 -0700 |
---|---|---|
committer | Chet Haase <chet@google.com> | 2013-08-21 14:01:02 -0700 |
commit | ef3cbfd4c42719d3e4feabb74c08f0311066c194 (patch) | |
tree | 1411335a915e4a5c646a7b0b5a7e76a1db684ac0 | |
parent | b3acd8ef263e17879e9a13c3dacd123bd0670c3b (diff) | |
download | frameworks_base-ef3cbfd4c42719d3e4feabb74c08f0311066c194.zip frameworks_base-ef3cbfd4c42719d3e4feabb74c08f0311066c194.tar.gz frameworks_base-ef3cbfd4c42719d3e4feabb74c08f0311066c194.tar.bz2 |
Cancel running LayoutTransition before removing it from a container
Previously, setting a new LayoutTransition object on a container would
not do anything to the old transition object (if it existed). This means
that the previous transition could be mid-flight, changing stuff in that
container, and would continue doing so even after it was removed.
This could cause artifacts like that in the bug below where views
that are fading out would be put in the containers "disappearing children"
list for the duration of the fade... and then would never be removed from
that list because the container was no longer connected to that transition.
This caused items to stay visible even after they were removed from
their parent containers.
Issue #10119571 LayoutTransitions sometimes does not honor view's visibility
Change-Id: I3efa4065e47fa97c4dd90410bbc1a0273c2b8079
-rw-r--r-- | core/java/android/view/ViewGroup.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index c874c82..d68c410 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -3855,12 +3855,17 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * the ViewGroup will be animated according to the animations defined in that LayoutTransition * object. By default, the transition object is null (so layout changes are not animated). * + * <p>Replacing a non-null transition will cause that previous transition to be + * canceled, if it is currently running, to restore this container to + * its correct post-transition state.</p> + * * @param transition The LayoutTransition object that will animated changes in layout. A value * of <code>null</code> means no transition will run on layout changes. * @attr ref android.R.styleable#ViewGroup_animateLayoutChanges */ public void setLayoutTransition(LayoutTransition transition) { if (mTransition != null) { + mTransition.cancel(); mTransition.removeTransitionListener(mLayoutTransitionListener); } mTransition = transition; |