From df7223b8e0850b9265987181983dd7be3b39ea80 Mon Sep 17 00:00:00 2001 From: Jeff DeCew Date: Mon, 10 May 2021 17:43:28 -0400 Subject: [PATCH] Simplify SmartReplyView padding layout logic The horizontal padding used to be dynamic based on the number of lines, but that hasn't been true for a while. The new goal is for padding to always be 16dp, except that the action icon is in the middle of that. Fixes: 78876518 Test: manual visual inspection with notify Test: atest SmartReplyViewTest Change-Id: I11400a552cab99d9f0ae31024d5973772e8ea300 --- .../res/layout/smart_action_button.xml | 2 + .../res/layout/smart_reply_button.xml | 2 + .../SystemUI/res/layout/smart_reply_view.xml | 2 - packages/SystemUI/res/values/attrs.xml | 2 - packages/SystemUI/res/values/dimens.xml | 5 +- .../statusbar/policy/SmartReplyView.java | 87 ++++--------------- .../statusbar/policy/SmartReplyViewTest.java | 23 ----- 7 files changed, 22 insertions(+), 101 deletions(-) diff --git a/packages/SystemUI/res/layout/smart_action_button.xml b/packages/SystemUI/res/layout/smart_action_button.xml index 271603479482b..488be3a4479e3 100644 --- a/packages/SystemUI/res/layout/smart_action_button.xml +++ b/packages/SystemUI/res/layout/smart_action_button.xml @@ -29,6 +29,8 @@ android:textSize="@dimen/smart_reply_button_font_size" android:lineSpacingExtra="@dimen/smart_reply_button_line_spacing_extra" android:textColor="@color/smart_reply_button_text" + android:paddingLeft="@dimen/smart_reply_button_action_padding_left" + android:paddingRight="@dimen/smart_reply_button_padding_horizontal" android:drawablePadding="@dimen/smart_action_button_icon_padding" android:textStyle="normal" android:ellipsize="none"/> diff --git a/packages/SystemUI/res/layout/smart_reply_button.xml b/packages/SystemUI/res/layout/smart_reply_button.xml index 9faed18287180..ddf16e0afed77 100644 --- a/packages/SystemUI/res/layout/smart_reply_button.xml +++ b/packages/SystemUI/res/layout/smart_reply_button.xml @@ -31,5 +31,7 @@ android:textSize="@dimen/smart_reply_button_font_size" android:lineSpacingExtra="@dimen/smart_reply_button_line_spacing_extra" android:textColor="@color/smart_reply_button_text" + android:paddingLeft="@dimen/smart_reply_button_padding_horizontal" + android:paddingRight="@dimen/smart_reply_button_padding_horizontal" android:textStyle="normal" android:ellipsize="none"/> diff --git a/packages/SystemUI/res/layout/smart_reply_view.xml b/packages/SystemUI/res/layout/smart_reply_view.xml index 9fffc72bcf6db..9d4d1db1ef285 100644 --- a/packages/SystemUI/res/layout/smart_reply_view.xml +++ b/packages/SystemUI/res/layout/smart_reply_view.xml @@ -24,8 +24,6 @@ android:layout_height="wrap_content" android:layout_width="wrap_content" systemui:spacing="@dimen/smart_reply_button_spacing" - systemui:singleLineButtonPaddingHorizontal="@dimen/smart_reply_button_padding_horizontal_single_line" - systemui:doubleLineButtonPaddingHorizontal="@dimen/smart_reply_button_padding_horizontal_double_line" systemui:buttonStrokeWidth="@dimen/smart_reply_button_stroke_width"> diff --git a/packages/SystemUI/res/values/attrs.xml b/packages/SystemUI/res/values/attrs.xml index eb724425b5d8b..067d56f3d157c 100644 --- a/packages/SystemUI/res/values/attrs.xml +++ b/packages/SystemUI/res/values/attrs.xml @@ -131,8 +131,6 @@ - - diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 24a3baf07e157..a97eb13fa7076 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -1147,9 +1147,8 @@ 8dp 14dp - - 16dp - 15dp + 16dp + 8dp 48dp 1dp 14sp diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java index 9e1ae8b89fc31..41b1dd12639a4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java @@ -23,6 +23,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; +import android.widget.TextView; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.ContrastColorUtil; @@ -58,15 +59,6 @@ public class SmartReplyView extends ViewGroup { /** Spacing to be applied between views. */ private final int mSpacing; - /** Horizontal padding of smart reply buttons if all of them use only one line of text. */ - private final int mSingleLineButtonPaddingHorizontal; - - /** Horizontal padding of smart reply buttons if at least one of them uses two lines of text. */ - private final int mDoubleLineButtonPaddingHorizontal; - - /** Increase in width of a smart reply button as a result of using two lines instead of one. */ - private final int mSingleToDoubleLineButtonWidthIncrease; - private final BreakIterator mBreakIterator; private PriorityQueue