From 0ba81607e30c008a7aa24ca76d74f9c4aaafd053 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Fri, 29 Jul 2016 11:22:21 -0700 Subject: Start shortcuts close animation where open left off. - Before we always started the close animation at 0 instead of the previous open progress, which looked janky. - Shortened the animations' durations and start delays to account for the fact that the open animation was only partially finished when the close animation started. Bug: 30465231 Change-Id: I958ee5f4543dbf1185f3d0229c55fc1b51929655 --- .../android/launcher3/util/RevealOutlineAnimation.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/com/android/launcher3/util') diff --git a/src/com/android/launcher3/util/RevealOutlineAnimation.java b/src/com/android/launcher3/util/RevealOutlineAnimation.java index cd9888232..456047775 100644 --- a/src/com/android/launcher3/util/RevealOutlineAnimation.java +++ b/src/com/android/launcher3/util/RevealOutlineAnimation.java @@ -38,6 +38,8 @@ public abstract class RevealOutlineAnimation extends ViewOutlineProvider { final float elevation = revealView.getElevation(); va.addListener(new AnimatorListenerAdapter() { + private boolean mWasCanceled = false; + public void onAnimationStart(Animator animation) { revealView.setOutlineProvider(RevealOutlineAnimation.this); revealView.setClipToOutline(true); @@ -46,11 +48,18 @@ public abstract class RevealOutlineAnimation extends ViewOutlineProvider { } } + @Override + public void onAnimationCancel(Animator animation) { + mWasCanceled = true; + } + public void onAnimationEnd(Animator animation) { - revealView.setOutlineProvider(ViewOutlineProvider.BACKGROUND); - revealView.setClipToOutline(false); - if (shouldRemoveElevationDuringAnimation()) { - revealView.setTranslationZ(0); + if (!mWasCanceled) { + revealView.setOutlineProvider(ViewOutlineProvider.BACKGROUND); + revealView.setClipToOutline(false); + if (shouldRemoveElevationDuringAnimation()) { + revealView.setTranslationZ(0); + } } } -- cgit v1.2.3