From afdad57bdfc0d4491eb67e8dac76abe32181848e Mon Sep 17 00:00:00 2001 From: Liran Binyamin Date: Wed, 14 Aug 2024 08:08:40 -0400 Subject: [PATCH] Don't reset alpha after dragging to dismiss After dragging the bubble bar to dismiss, don't reset its alpha value. Flag: com.android.wm.shell.enable_bubble_bar Fixes: 359804931 Test: manual - Create a bubble in the bubble bar - Drag bubble bar to dismiss - Create another bubble - Observe the new bubble does not flicker Change-Id: I8d56f71d38ec33acda8efade50735b59254d77d4 --- .../launcher3/taskbar/bubbles/BubbleBarView.java | 4 +++- .../launcher3/taskbar/bubbles/BubbleDragAnimator.java | 11 +++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java index 819c4737ea..d911fd472d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java @@ -647,7 +647,9 @@ public class BubbleBarView extends FrameLayout { } setAlphaDuringBubbleDrag(1f); setTranslationX(0f); - setAlpha(1f); + if (getBubbleChildCount() > 0) { + setAlpha(1f); + } } /** diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDragAnimator.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDragAnimator.java index 7aed2d2abe..87f466f5d3 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDragAnimator.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDragAnimator.java @@ -128,7 +128,7 @@ public class BubbleDragAnimator { boolean wasFling, boolean canceled, float finalValue, float finalVelocity, boolean allRelevantPropertyAnimationsEnded) -> { if (canceled || allRelevantPropertyAnimationsEnded) { - resetAnimatedViews(restingPosition); + resetAnimatedViews(restingPosition, /* dismissed= */ false); if (endActions != null) { endActions.run(); } @@ -197,7 +197,7 @@ public class BubbleDragAnimator { boolean wasFling, boolean canceled, float finalValue, float finalVelocity, boolean allRelevantPropertyAnimationsEnded) -> { if (canceled || allRelevantPropertyAnimationsEnded) { - resetAnimatedViews(initialPosition); + resetAnimatedViews(initialPosition, /* dismissed= */ true); if (endActions != null) endActions.run(); } }) @@ -208,11 +208,14 @@ public class BubbleDragAnimator { * Reset the animated views to the initial state * * @param initialPosition position of the bubble + * @param dismissed whether the animated view was dismissed */ - private void resetAnimatedViews(@NonNull PointF initialPosition) { + private void resetAnimatedViews(@NonNull PointF initialPosition, boolean dismissed) { mView.setScaleX(1f); mView.setScaleY(1f); - mView.setAlpha(1f); + if (!dismissed) { + mView.setAlpha(1f); + } mView.setTranslationX(initialPosition.x); mView.setTranslationY(initialPosition.y);