From 9438ed414fdabadb4cd09da184867b1c44b91095 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Fri, 20 Jan 2017 09:38:25 -0800 Subject: Add swipe-to-dismiss notifications in popup menu. - Next secondary icon animates up to replace dismissed main notification - Add padding around main notification so it always aligns with the straight edges of the view (not the rounded corners); looks more dismissable - Notification view collapses as notifications are dismissed - To mimic system notification behavior, we copy SwipeHelper, FlingAnimationUtils, and Interpolators. We also apply elevation to notifications and reveal a darker color beneath when dismissing. Bug: 32410600 Change-Id: I9fbf10e73bb4996f17ef061c856efb013967d972 --- src/com/android/launcher3/LauncherAnimUtils.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/com/android/launcher3/LauncherAnimUtils.java') diff --git a/src/com/android/launcher3/LauncherAnimUtils.java b/src/com/android/launcher3/LauncherAnimUtils.java index 01e73d4a1..9ea277c13 100644 --- a/src/com/android/launcher3/LauncherAnimUtils.java +++ b/src/com/android/launcher3/LauncherAnimUtils.java @@ -23,7 +23,9 @@ import android.animation.PropertyValuesHolder; import android.animation.ValueAnimator; import android.util.Property; import android.view.View; +import android.view.ViewGroup; import android.view.ViewTreeObserver; +import android.widget.ViewAnimator; import java.util.HashSet; import java.util.WeakHashMap; @@ -127,4 +129,18 @@ public class LauncherAnimUtils { new FirstFrameAnimatorHelper(anim, view); return anim; } + + public static ValueAnimator animateViewHeight(final View v, int fromHeight, int toHeight) { + ValueAnimator anim = ValueAnimator.ofInt(fromHeight, toHeight); + anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(ValueAnimator valueAnimator) { + int val = (Integer) valueAnimator.getAnimatedValue(); + ViewGroup.LayoutParams layoutParams = v.getLayoutParams(); + layoutParams.height = val; + v.setLayoutParams(layoutParams); + } + }); + return anim; + } } -- cgit v1.2.3