diff --git a/src/com/android/launcher3/LauncherAnimUtils.java b/src/com/android/launcher3/LauncherAnimUtils.java index 5d4f9c67e2..e6c220b2a2 100644 --- a/src/com/android/launcher3/LauncherAnimUtils.java +++ b/src/com/android/launcher3/LauncherAnimUtils.java @@ -25,12 +25,13 @@ import android.view.View; import android.view.ViewTreeObserver; import java.util.HashSet; +import java.util.WeakHashMap; public class LauncherAnimUtils { - static HashSet sAnimators = new HashSet(); + static WeakHashMap sAnimators = new WeakHashMap(); static Animator.AnimatorListener sEndAnimListener = new Animator.AnimatorListener() { public void onAnimationStart(Animator animation) { - sAnimators.add(animation); + sAnimators.put(animation, null); } public void onAnimationRepeat(Animator animation) { @@ -74,13 +75,12 @@ public class LauncherAnimUtils { } public static void onDestroyActivity() { - HashSet animators = new HashSet(sAnimators); + HashSet animators = new HashSet(sAnimators.keySet()); for (Animator a : animators) { if (a.isRunning()) { a.cancel(); - } else { - sAnimators.remove(a); } + sAnimators.remove(a); } }