From f172c0b3b5f7616906b44ddd122e366613a504ec Mon Sep 17 00:00:00 2001 From: Liran Binyamin Date: Wed, 26 Jul 2023 12:11:51 -0400 Subject: [PATCH] Set the stash handle bounds deterministically The bounds of the bubble stash handle is calculated based on the bounds of the bubble bar. The problem is that the bubble bar could be invisible, which results in incorrect bounds set for the handle. This change sets the bounds for the handle based on the width of the screen. Fixes: 290992144 Test: Manual - Remove bubbles - Restart Launcher - Open the bubble test app and double tap on a chat - Observe that the handle animates in Change-Id: Ida260014d59b88387de010891c18057f3b091e93 --- .../taskbar/bubbles/BubbleBarViewController.java | 5 +++++ .../bubbles/BubbleStashedHandleViewController.java | 11 +++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java index f5e2ddc6cf..6da1a2a8ef 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java @@ -152,6 +152,11 @@ public class BubbleBarViewController { return mBarView.getBubbleBarBounds(); } + /** The horizontal margin of the bubble bar from the edge of the screen. */ + public int getHorizontalMargin() { + return mBarView.getHorizontalMargin(); + } + /** * When the bubble bar is not stashed, it can be collapsed (the icons are in a stack) or * expanded (the icons are in a row). This indicates whether the bubble bar is expanded. diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java index 4c197f6b57..fbab59531c 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java @@ -123,13 +123,15 @@ public class BubbleStashedHandleViewController { private void updateBounds() { // As more bubbles get added, the icon bounds become larger. To ensure a consistent // handle bar position, we pin it to the edge of the screen. - Rect bubblebarRect = mBarViewController.getBubbleBarBounds(); + final int right = + mActivity.getDeviceProfile().widthPx - mBarViewController.getHorizontalMargin(); + final int stashedCenterY = mStashedHandleView.getHeight() - mStashedTaskbarHeight / 2; mStashedHandleBounds.set( - bubblebarRect.right - mStashedHandleWidth, + right - mStashedHandleWidth, stashedCenterY - mStashedHandleHeight / 2, - bubblebarRect.right, + right, stashedCenterY + mStashedHandleHeight / 2); mStashedHandleView.updateSampledRegion(mStashedHandleBounds); @@ -240,9 +242,6 @@ public class BubbleStashedHandleViewController { */ public Animator createRevealAnimToIsStashed(boolean isStashed) { Rect bubbleBarBounds = new Rect(mBarViewController.getBubbleBarBounds()); - // the bubble bar may have been invisible when the bounds were previously calculated, - // update them again to ensure they're correct. - updateBounds(); // Account for the full visual height of the bubble bar int heightDiff = (mBarSize - bubbleBarBounds.height()) / 2;