From 79a58ee2b9bf11680e367141297c55b622ae1428 Mon Sep 17 00:00:00 2001 From: Joshua Tsuji Date: Fri, 27 Mar 2020 17:55:37 -0400 Subject: Polish dismiss animations. Test: manual Fixes: 153461002 Change-Id: I0a3529e173676a438c0634bc8e7954252866f7b2 --- .../android/systemui/bubbles/BubbleStackView.java | 8 +++++--- .../animation/ExpandedAnimationController.java | 3 ++- .../animation/StackAnimationController.java | 23 +++++++++++----------- 3 files changed, 18 insertions(+), 16 deletions(-) (limited to 'packages/SystemUI') diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java index 644e54fb82ae..1329f04e55cd 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java @@ -371,8 +371,9 @@ public class BubbleStackView extends FrameLayout { @Override public void onReleasedInTarget(@NonNull MagnetizedObject.MagneticTarget target) { mExpandedAnimationController.dismissDraggedOutBubble( - mExpandedAnimationController.getDraggedOutBubble(), - BubbleStackView.this::dismissMagnetizedObject); + mExpandedAnimationController.getDraggedOutBubble() /* bubble */, + mDismissTargetContainer.getHeight() /* translationYBy */, + BubbleStackView.this::dismissMagnetizedObject /* after */); hideDismissTarget(); } }; @@ -402,7 +403,8 @@ public class BubbleStackView extends FrameLayout { @Override public void onReleasedInTarget(@NonNull MagnetizedObject.MagneticTarget target) { - mStackAnimationController.implodeStack( + mStackAnimationController.animateStackDismissal( + mDismissTargetContainer.getHeight() /* translationYBy */, () -> { resetDesaturationAndDarken(); dismissMagnetizedObject(); diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java b/packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java index d974adc34ee0..0002e862bb41 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java @@ -329,7 +329,7 @@ public class ExpandedAnimationController } /** Plays a dismiss animation on the dragged out bubble. */ - public void dismissDraggedOutBubble(View bubble, Runnable after) { + public void dismissDraggedOutBubble(View bubble, float translationYBy, Runnable after) { if (bubble == null) { return; } @@ -337,6 +337,7 @@ public class ExpandedAnimationController .withStiffness(SpringForce.STIFFNESS_HIGH) .scaleX(1.1f) .scaleY(1.1f) + .translationY(bubble.getTranslationY() + translationYBy) .alpha(0f, after) .start(); diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java b/packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java index 00de8b4a51b8..5f3a2bd9eb8b 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java @@ -647,17 +647,18 @@ public class StackAnimationController extends } /** - * 'Implode' the stack by shrinking the bubbles via chained animations and fading them out. + * 'Implode' the stack by shrinking the bubbles, fading them out, and translating them down. */ - public void implodeStack(Runnable after) { - // Pop and fade the bubbles sequentially. - animationForChildAtIndex(0) - .scaleX(0.5f) - .scaleY(0.5f) - .alpha(0f) - .withDampingRatio(SpringForce.DAMPING_RATIO_NO_BOUNCY) - .withStiffness(SpringForce.STIFFNESS_HIGH) - .start(after); + public void animateStackDismissal(float translationYBy, Runnable after) { + animationsForChildrenFromIndex(0, (index, animation) -> + animation + .scaleX(0.5f) + .scaleY(0.5f) + .alpha(0f) + .translationY( + mLayout.getChildAt(index).getTranslationY() + translationYBy) + .withStiffness(SpringForce.STIFFNESS_HIGH)) + .startAll(after); } /** @@ -710,8 +711,6 @@ public class StackAnimationController extends if (property.equals(DynamicAnimation.TRANSLATION_X) || property.equals(DynamicAnimation.TRANSLATION_Y)) { return index + 1; - } else if (isStackStuckToTarget()) { - return index + 1; // Chain all animations in dismiss (scale, alpha, etc. are used). } else { return NONE; } -- cgit v1.2.3-59-g8ed1b