From cbda9104d029a8420786bd17725e8b1fb0c4c188 Mon Sep 17 00:00:00 2001 From: Ben Komalo Date: Thu, 16 Dec 2010 15:55:27 -0800 Subject: [PATCH] Fix incorrect anonymous AnimatorListenerAdapter. Change-Id: I0384a437089d11dda03d0657235404ea96e8b19d --- core/java/android/animation/LayoutTransition.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/core/java/android/animation/LayoutTransition.java b/core/java/android/animation/LayoutTransition.java index cb06c89ba2ef9..636f5472027e0 100644 --- a/core/java/android/animation/LayoutTransition.java +++ b/core/java/android/animation/LayoutTransition.java @@ -153,8 +153,9 @@ public class LayoutTransition { * we cache all of the current animations in this map for possible cancellation on * another layout event. */ - private HashMap currentChangingAnimations = new HashMap(); - private HashMap currentVisibilityAnimations = new HashMap(); + private final HashMap currentChangingAnimations = new HashMap(); + private final HashMap currentVisibilityAnimations = + new HashMap(); /** * This hashmap is used to track the listeners that have been added to the children of @@ -165,7 +166,7 @@ public class LayoutTransition { * the process of setting up and running all appropriate animations is done, we need to * remove these listeners and clear out the map. */ - private HashMap layoutChangeListenerMap = + private final HashMap layoutChangeListenerMap = new HashMap(); /** @@ -599,12 +600,14 @@ public class LayoutTransition { // Remove the animation from the cache when it ends anim.addListener(new AnimatorListenerAdapter() { private boolean canceled = false; + @Override public void onAnimationCancel(Animator animator) { // we remove canceled animations immediately, not here canceled = true; child.removeOnLayoutChangeListener(listener); layoutChangeListenerMap.remove(child); } + @Override public void onAnimationEnd(Animator animator) { if (!canceled) { currentChangingAnimations.remove(child); @@ -662,7 +665,8 @@ public class LayoutTransition { } if (mListeners != null) { anim.addListener(new AnimatorListenerAdapter() { - public void onAnimationEnd() { + @Override + public void onAnimationEnd(Animator anim) { currentVisibilityAnimations.remove(child); for (TransitionListener listener : mListeners) { listener.endTransition(LayoutTransition.this, parent, child, APPEARING);