From 14f76fe13b4606ff8625917e6dd3a0f826f9e626 Mon Sep 17 00:00:00 2001 From: Ats Jenk Date: Tue, 23 Jan 2024 16:59:59 -0800 Subject: [PATCH] Move bubble bar stashed handle to the left for RTL When system language is set to an RTL language, we move the bubble bar to the left. Move the stashed bubble bar handle to the left in this case. Tweak the bubble bar expand animation so that the bubbles expand from the left edge. Flag: LEGACY persist.wm.debug.bubble_bar DEVELOPMENT Bug: 273310265 Test: repeat following steps with LTR and RTL system languages - add couple of bubbles to bubble bar, open an app, observe stashed handle on the left - swipe up from system navbar to show taskbar and bubble bar - swipe up from bubble bar handle to show bubble bar and expand it - drag bubble bar to dismiss target and back out and release Change-Id: Ia3b7892bba732a5278168d63db0594087f55fad4 --- .../taskbar/bubbles/BubbleBarView.java | 6 ++-- .../BubbleStashedHandleViewController.java | 34 +++++++++++++------ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java index 1e7b3e2fa2..fbc7da1827 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java @@ -199,8 +199,10 @@ public class BubbleBarView extends FrameLayout { @Override public void onRtlPropertiesChanged(int layoutDirection) { - // TODO(b/273310265): set this based on bubble bar position and not LTR or RTL - mBubbleBarBackground.setAnchorLeft(layoutDirection == LAYOUT_DIRECTION_RTL); + // TODO(b/313661121): set this based on bubble bar position and not LTR or RTL + boolean onLeft = layoutDirection == LAYOUT_DIRECTION_RTL; + mBubbleBarBackground.setAnchorLeft(onLeft); + mRelativePivotX = onLeft ? 0f : 1f; } private boolean isOnLeft() { diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java index c998d9704e..f88460ff13 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java @@ -16,6 +16,7 @@ package com.android.launcher3.taskbar.bubbles; import static android.view.View.INVISIBLE; +import static android.view.View.LAYOUT_DIRECTION_RTL; import static android.view.View.VISIBLE; import android.animation.Animator; @@ -124,22 +125,35 @@ 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. - final int right = - mActivity.getDeviceProfile().widthPx - mBarViewController.getHorizontalMargin(); - final int stashedCenterY = mStashedHandleView.getHeight() - mStashedTaskbarHeight / 2; + if (isOnLeft()) { + final int left = mBarViewController.getHorizontalMargin(); + mStashedHandleBounds.set( + left, + stashedCenterY - mStashedHandleHeight / 2, + left + mStashedHandleWidth, + stashedCenterY + mStashedHandleHeight / 2); + mStashedHandleView.setPivotX(0); + } else { + final int right = + mActivity.getDeviceProfile().widthPx - mBarViewController.getHorizontalMargin(); + mStashedHandleBounds.set( + right - mStashedHandleWidth, + stashedCenterY - mStashedHandleHeight / 2, + right, + stashedCenterY + mStashedHandleHeight / 2); + mStashedHandleView.setPivotX(mStashedHandleView.getWidth()); + } - mStashedHandleBounds.set( - right - mStashedHandleWidth, - stashedCenterY - mStashedHandleHeight / 2, - right, - stashedCenterY + mStashedHandleHeight / 2); mStashedHandleView.updateSampledRegion(mStashedHandleBounds); - - mStashedHandleView.setPivotX(mStashedHandleView.getWidth()); mStashedHandleView.setPivotY(mStashedHandleView.getHeight() - mStashedTaskbarHeight / 2f); } + private boolean isOnLeft() { + // TODO(b/313661121): set this based on bubble bar position and not LTR or RTL + return mStashedHandleView.getLayoutDirection() == LAYOUT_DIRECTION_RTL; + } + public void onDestroy() { mRegionSamplingHelper.stopAndDestroy(); mRegionSamplingHelper = null;