From 8be486f83b277842ef5face04b75c127b53d2ab9 Mon Sep 17 00:00:00 2001 From: Yining Liu Date: Thu, 23 Mar 2023 22:35:08 +0000 Subject: [PATCH] Fix text clipping of EmphasizedNotificationButton, when the system font size is at maximum Fixes the visually clipped text of EmphasizedNotificationButton (which is used in sticky HUNs, CallStyleNotifications, etc.), when the Accessibility - Display size and text - font size is at its maximum(2.0 scale). Test: Manual. Go to Settings > Accessibility > Display size and text. Adjust the "Font size" to the biggest. Post a sticky HUN, and a CallStyleNotification. The action button texts shouldn't be clipped either when the notifications are showing as HUNs, or in the Shade. Bug: 273401782 Bug: 274783980 Change-Id: Id87bb579fe966de832b0f95a2a950a2778217031 --- .../android/internal/widget/NotificationActionListLayout.java | 4 +++- .../res/layout/notification_material_action_emphasized.xml | 3 ++- .../notification_material_action_emphasized_tombstone.xml | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/core/java/com/android/internal/widget/NotificationActionListLayout.java b/core/java/com/android/internal/widget/NotificationActionListLayout.java index 3191e23a9883e..302d2e797e741 100644 --- a/core/java/com/android/internal/widget/NotificationActionListLayout.java +++ b/core/java/com/android/internal/widget/NotificationActionListLayout.java @@ -361,13 +361,15 @@ public class NotificationActionListLayout extends LinearLayout { // same padding on bottom and at end int paddingBottom = getResources().getDimensionPixelSize( com.android.internal.R.dimen.notification_content_margin_end); - height = mEmphasizedHeight; int buttonPaddingInternal = getResources().getDimensionPixelSize( com.android.internal.R.dimen.button_inset_vertical_material); setPaddingRelative(getPaddingStart(), paddingTop - buttonPaddingInternal, getPaddingEnd(), paddingBottom - buttonPaddingInternal); + + setMinimumHeight(mEmphasizedHeight); + height = ViewGroup.LayoutParams.WRAP_CONTENT; } else { setPaddingRelative(getPaddingStart(), mDefaultPaddingTop, diff --git a/core/res/res/layout/notification_material_action_emphasized.xml b/core/res/res/layout/notification_material_action_emphasized.xml index ea841851cd443..ac90948c8b126 100644 --- a/core/res/res/layout/notification_material_action_emphasized.xml +++ b/core/res/res/layout/notification_material_action_emphasized.xml @@ -19,7 +19,8 @@ style="@style/NotificationEmphasizedAction" android:id="@+id/action0" android:layout_width="wrap_content" - android:layout_height="match_parent" + android:layout_height="wrap_content" + android:minHeight="@dimen/notification_action_emphasized_height" android:layout_marginStart="12dp" android:drawablePadding="6dp" android:gravity="center" diff --git a/core/res/res/layout/notification_material_action_emphasized_tombstone.xml b/core/res/res/layout/notification_material_action_emphasized_tombstone.xml index 60f10dbcdebc6..16ea70c70ec18 100644 --- a/core/res/res/layout/notification_material_action_emphasized_tombstone.xml +++ b/core/res/res/layout/notification_material_action_emphasized_tombstone.xml @@ -20,7 +20,8 @@ style="@style/NotificationEmphasizedAction" android:id="@+id/action0" android:layout_width="wrap_content" - android:layout_height="match_parent" + android:layout_height="wrap_content" + android:minHeight="@dimen/notification_action_emphasized_height" android:layout_marginStart="12dp" android:drawablePadding="6dp" android:enabled="false"