diff options
| author | Chet Haase <chet@google.com> | 2011-08-11 11:32:43 -0700 |
|---|---|---|
| committer | Chet Haase <chet@google.com> | 2011-08-11 11:32:43 -0700 |
| commit | e115ffeb3a05f440c0062ad9b3954b7fefef4b00 (patch) | |
| tree | 2e91b58414411b30b65d5e7761b0e9a72866e732 /core | |
| parent | 5e3f4000a98eb494e3c896de7af97b1b85bbad42 (diff) | |
| download | frameworks_base-e115ffeb3a05f440c0062ad9b3954b7fefef4b00.zip frameworks_base-e115ffeb3a05f440c0062ad9b3954b7fefef4b00.tar.gz frameworks_base-e115ffeb3a05f440c0062ad9b3954b7fefef4b00.tar.bz2 | |
Fix behavior of custom animations for LayoutTransition.
Previously, setting custom animations on a LayoutTransition would cause
those animations to be run not only for changing views in the container, but
for the parent hierarchy of those views as well. This can lead to unexpected
behavior, as seen in the ApiDemos LayoutAnimations and LayoutAnimationsHideShow.
This change changes the behavior so that the parent hierarchy is animated by
the default animations (which change the bounds and scrollX/Y fields) instead
of custom animations.
Change-Id: I9a04d97fabbc34dc0d5809eb3fd8ac08e0801d7c
Diffstat (limited to 'core')
| -rw-r--r-- | core/java/android/animation/LayoutTransition.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/core/java/android/animation/LayoutTransition.java b/core/java/android/animation/LayoutTransition.java index 06d18ec..9e2b833 100644 --- a/core/java/android/animation/LayoutTransition.java +++ b/core/java/android/animation/LayoutTransition.java @@ -593,11 +593,13 @@ public class LayoutTransition { } } if (mAnimateParentHierarchy) { + Animator parentAnimator = (changeReason == APPEARING) ? + defaultChangeIn : defaultChangeOut; ViewGroup tempParent = parent; while (tempParent != null) { ViewParent parentParent = tempParent.getParent(); if (parentParent instanceof ViewGroup) { - setupChangeAnimation((ViewGroup)parentParent, changeReason, baseAnimator, + setupChangeAnimation((ViewGroup)parentParent, changeReason, parentAnimator, duration, tempParent); tempParent = (ViewGroup) parentParent; } else { @@ -626,12 +628,18 @@ public class LayoutTransition { /** * This flag controls whether CHANGE_APPEARING or CHANGE_DISAPPEARING animations will - * cause the same changing animation to be run on the parent hierarchy as well. This allows + * cause the default changing animation to be run on the parent hierarchy as well. This allows * containers of transitioning views to also transition, which may be necessary in situations * where the containers bounds change between the before/after states and may clip their * children during the transition animations. For example, layouts with wrap_content will * adjust their bounds according to the dimensions of their children. * + * <p>The default changing transitions animate the bounds and scroll positions of the + * target views. These are the animations that will run on the parent hierarchy, not + * the custom animations that happen to be set on the transition. This allows custom + * behavior for the children of the transitioning container, but uses standard behavior + * of resizing/rescrolling on any changing parents. + * * @param animateParentHierarchy A boolean value indicating whether the parents of * transitioning views should also be animated during the transition. Default value is true. */ |
