summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/popup
diff options
context:
space:
mode:
authorTony <twickham@google.com>2017-06-28 17:51:53 -0700
committerTony Wickham <twickham@google.com>2017-06-29 13:43:35 -0700
commitd6573ed1283c18bbb96c8d617c799b78165f287f (patch)
tree499049439ca24683ca3320c92a3bc6a5cfe2d8cf /src/com/android/launcher3/popup
parent6f7f4bb97e574c409ba409b67c5ed6903967da6c (diff)
downloadandroid_packages_apps_Trebuchet-d6573ed1283c18bbb96c8d617c799b78165f287f.tar.gz
android_packages_apps_Trebuchet-d6573ed1283c18bbb96c8d617c799b78165f287f.tar.bz2
android_packages_apps_Trebuchet-d6573ed1283c18bbb96c8d617c799b78165f287f.zip
Tweak popup animation
- Decrease duration - Add alpha fade in and out - Remove arrow scale when closing, so that the reversal happens immediately These changes help the popup feel snappier while also reducing visual jank when moving icons (as the animation accelerates in later and the alpha stays close to 0). Bug: 62738635 Change-Id: Ic8af4e0e5bc00913ea713853997069e8b9c8f953
Diffstat (limited to 'src/com/android/launcher3/popup')
-rw-r--r--src/com/android/launcher3/popup/PopupContainerWithArrow.java28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index 81076259d..c6ae0d290 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -20,6 +20,7 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
+import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.content.Context;
@@ -353,6 +354,8 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra
final AnimatorSet openAnim = LauncherAnimUtils.createAnimatorSet();
final Resources res = getResources();
+ final long revealDuration = (long) res.getInteger(R.integer.config_popupOpenCloseDuration);
+ final TimeInterpolator revealInterpolator = new AccelerateDecelerateInterpolator();
// Rectangular reveal.
int itemsTotalHeight = 0;
@@ -366,8 +369,13 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra
mEndRect.set(0, top, getMeasuredWidth(), top + itemsTotalHeight);
final ValueAnimator revealAnim = new RoundedRectRevealOutlineProvider
(radius, radius, mStartRect, mEndRect).createRevealAnimator(this, false);
- revealAnim.setDuration((long) res.getInteger(R.integer.config_popupOpenCloseDuration));
- revealAnim.setInterpolator(new AccelerateDecelerateInterpolator());
+ revealAnim.setDuration(revealDuration);
+ revealAnim.setInterpolator(revealInterpolator);
+
+ Animator fadeIn = ObjectAnimator.ofFloat(this, ALPHA, 0, 1);
+ fadeIn.setDuration(revealDuration);
+ fadeIn.setInterpolator(revealInterpolator);
+ openAnim.play(fadeIn);
// Animate the arrow.
mArrow.setScaleX(0);
@@ -851,10 +859,8 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra
final AnimatorSet closeAnim = LauncherAnimUtils.createAnimatorSet();
final Resources res = getResources();
-
- // Animate the arrow.
- Animator arrowScale = createArrowScaleAnim(0).setDuration(res.getInteger(
- R.integer.config_popupArrowOpenDuration));
+ final long revealDuration = (long) res.getInteger(R.integer.config_popupOpenCloseDuration);
+ final TimeInterpolator revealInterpolator = new AccelerateDecelerateInterpolator();
// Rectangular reveal (reversed).
int itemsTotalHeight = 0;
@@ -870,9 +876,14 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra
}
final ValueAnimator revealAnim = new RoundedRectRevealOutlineProvider(
radius, radius, mStartRect, mEndRect).createRevealAnimator(this, true);
- long revealDuration = (long) res.getInteger(R.integer.config_popupOpenCloseDuration);
revealAnim.setDuration(revealDuration);
- revealAnim.setInterpolator(new AccelerateDecelerateInterpolator());
+ revealAnim.setInterpolator(revealInterpolator);
+ closeAnim.play(revealAnim);
+
+ Animator fadeOut = ObjectAnimator.ofFloat(this, ALPHA, 0);
+ fadeOut.setDuration(revealDuration);
+ fadeOut.setInterpolator(revealInterpolator);
+ closeAnim.play(fadeOut);
// Animate original icon's text back in.
Animator fadeText = mOriginalIcon.createTextAlphaAnimator(true /* fadeIn */);
@@ -891,7 +902,6 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra
}
});
mOpenCloseAnimator = closeAnim;
- closeAnim.playSequentially(arrowScale, revealAnim);
closeAnim.start();
mOriginalIcon.forceHideBadge(false);
}