diff options
| author | 2023-11-07 16:14:46 +0000 | |
|---|---|---|
| committer | 2023-11-07 16:14:46 +0000 | |
| commit | c83ee48c151dbc928164db3bd4f4168f63aaba4c (patch) | |
| tree | ec636b94360fb7bbd904de5539921b8c57e71ee4 | |
| parent | cb67c593df4ad10ffc4b6cf3bed8ddc37180bada (diff) | |
| parent | ba0ce0773419147d50f4757f01783f766c696efe (diff) | |
Merge "Fix bubbles manage button touch target" into main
4 files changed, 21 insertions, 7 deletions
diff --git a/libs/WindowManager/Shell/res/drawable/bubble_manage_btn_bg.xml b/libs/WindowManager/Shell/res/drawable/bubble_manage_btn_bg.xml index d2360e9b1ae0..657720ee6088 100644 --- a/libs/WindowManager/Shell/res/drawable/bubble_manage_btn_bg.xml +++ b/libs/WindowManager/Shell/res/drawable/bubble_manage_btn_bg.xml @@ -21,7 +21,7 @@ <solid android:color="?androidprv:attr/materialColorSurfaceContainerHigh" /> - <corners android:radius="20dp" /> + <corners android:radius="18sp" /> <padding android:left="20dp" diff --git a/libs/WindowManager/Shell/res/values/dimen.xml b/libs/WindowManager/Shell/res/values/dimen.xml index 55a91323295a..de9d2a292540 100644 --- a/libs/WindowManager/Shell/res/values/dimen.xml +++ b/libs/WindowManager/Shell/res/values/dimen.xml @@ -185,10 +185,11 @@ <dimen name="bubble_pointer_overlap">1dp</dimen> <!-- Extra padding around the dismiss target for bubbles --> <dimen name="bubble_dismiss_slop">16dp</dimen> - <!-- Height of button allowing users to adjust settings for bubbles. --> - <dimen name="bubble_manage_button_height">36dp</dimen> - <!-- Height of manage button including margins. --> - <dimen name="bubble_manage_button_total_height">68dp</dimen> + <!-- Height of button allowing users to adjust settings for bubbles. We use sp so that the + button can scale with the font size. --> + <dimen name="bubble_manage_button_height">36sp</dimen> + <!-- Touch area height of the manage button. --> + <dimen name="bubble_manage_button_touch_area_height">48dp</dimen> <!-- The margin around the outside of the manage button. --> <dimen name="bubble_manage_button_margin">16dp</dimen> <!-- Height of an item in the bubble manage menu. --> diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java index 0568edaa7ab6..c7ab6aa3934e 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java @@ -57,6 +57,7 @@ import android.util.Log; import android.util.TypedValue; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; +import android.view.TouchDelegate; import android.view.View; import android.view.ViewGroup; import android.view.ViewOutlineProvider; @@ -470,6 +471,17 @@ public class BubbleExpandedView extends LinearLayout { R.layout.bubble_manage_button, this /* parent */, false /* attach */); addView(mManageButton); mManageButton.setVisibility(visibility); + post(() -> { + int touchAreaHeight = + getResources().getDimensionPixelSize( + R.dimen.bubble_manage_button_touch_area_height); + Rect r = new Rect(); + mManageButton.getHitRect(r); + int extraTouchArea = (touchAreaHeight - r.height()) / 2; + r.top -= extraTouchArea; + r.bottom += extraTouchArea; + setTouchDelegate(new TouchDelegate(r, mManageButton)); + }); } } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java index 17e06e93b3a8..144c456f8838 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java @@ -198,9 +198,10 @@ public class BubblePositioner { mPointerHeight = res.getDimensionPixelSize(R.dimen.bubble_pointer_height); mPointerMargin = res.getDimensionPixelSize(R.dimen.bubble_pointer_margin); mPointerOverlap = res.getDimensionPixelSize(R.dimen.bubble_pointer_overlap); - mManageButtonHeightIncludingMargins = - res.getDimensionPixelSize(R.dimen.bubble_manage_button_total_height); mManageButtonHeight = res.getDimensionPixelSize(R.dimen.bubble_manage_button_height); + mManageButtonHeightIncludingMargins = + mManageButtonHeight + + 2 * res.getDimensionPixelSize(R.dimen.bubble_manage_button_margin); mExpandedViewMinHeight = res.getDimensionPixelSize(R.dimen.bubble_expanded_default_height); mOverflowHeight = res.getDimensionPixelSize(R.dimen.bubble_overflow_height); mMinimumFlyoutWidthLargeScreen = res.getDimensionPixelSize( |