From 1e7e52b92302cd4769232a775ae7b4a15d668fa0 Mon Sep 17 00:00:00 2001 From: mpodolian Date: Mon, 22 Apr 2024 11:41:11 +0100 Subject: [PATCH] Removed arrow animation on selected bubble closing. We should first decide how we would like to animate dismissal of the selected bubble, and than implement arrow animation. The issue exists because background is shrinked without an animation. Test: Visual Fixes: 293350516 Flag: ACONFIG com.android.wm.shell.enable_bubble_bar DEVELOPMENT Change-Id: Ia0cf04671bf9e93c98c45c99a21865055462e6df --- .../launcher3/taskbar/bubbles/BubbleBarView.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java index 1003c3f8e0..79774aab1f 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java @@ -120,6 +120,7 @@ public class BubbleBarView extends FrameLayout { // Whether the bar is expanded (i.e. the bubble activity is being displayed). private boolean mIsBarExpanded = false; // The currently selected bubble view. + @Nullable private BubbleView mSelectedBubbleView; private BubbleBarLocation mBubbleBarLocation = BubbleBarLocation.DEFAULT; // The click listener when the bubble bar is collapsed. @@ -204,6 +205,7 @@ public class BubbleBarView extends FrameLayout { // If the bar was just collapsed and the overflow was the last bubble that was // selected, set the first bubble as selected. if (!mIsBarExpanded && mUpdateSelectedBubbleAfterCollapse != null + && mSelectedBubbleView != null && mSelectedBubbleView.getBubble() instanceof BubbleBarOverflow) { BubbleView firstBubble = (BubbleView) getChildAt(0); mUpdateSelectedBubbleAfterCollapse.accept(firstBubble.getBubble().getKey()); @@ -533,6 +535,10 @@ public class BubbleBarView extends FrameLayout { @Override public void removeView(View view) { super.removeView(view); + if (view == mSelectedBubbleView) { + mSelectedBubbleView = null; + mBubbleBarBackground.showArrow(false); + } updateWidth(); } @@ -688,8 +694,12 @@ public class BubbleBarView extends FrameLayout { * Sets which bubble view should be shown as selected. */ public void setSelectedBubble(BubbleView view) { + BubbleView previouslySelectedBubble = mSelectedBubbleView; mSelectedBubbleView = view; - updateArrowForSelected(/* shouldAnimate= */ true); + mBubbleBarBackground.showArrow(view != null); + // TODO: (b/283309949) remove animation should be implemented first, so than arrow + // animation is adjusted, skip animation for now + updateArrowForSelected(previouslySelectedBubble != null); } /** @@ -714,6 +724,10 @@ public class BubbleBarView extends FrameLayout { // Find the center of the bubble when it's expanded, set the arrow position to it. final float tx = arrowPositionForSelectedWhenExpanded(); final float currentArrowPosition = mBubbleBarBackground.getArrowPositionX(); + if (tx == currentArrowPosition) { + // arrow position remains unchanged + return; + } if (shouldAnimate && currentArrowPosition > expandedWidth()) { Log.d(TAG, "arrow out of bounds of expanded view, skip animation"); shouldAnimate = false;