From 2ca6b4399a4380b38c922c5152d7086ce11d211f Mon Sep 17 00:00:00 2001 From: Jeff DeCew Date: Mon, 10 May 2021 12:44:27 -0400 Subject: [PATCH 1/4] Update the style of emphasized notification actions. * This removed many of the differences between CallStyle and emphasized actions. * These actions are now pill shaped with a solid bg color, no stroke, less height, less spacing between, and wrapping content instead of splitting space equally. Fixes: 187533622 Test: manual testing with Notify, Notify2, and Clock (using timers and alarms) Change-Id: I8c554755755c59f2756870f7cd2e0c533d22d823 --- core/java/android/app/Notification.java | 37 +++++++++++-------- .../widget/EmphasizedNotificationButton.java | 27 ++------------ .../widget/NotificationActionListLayout.java | 22 +---------- .../drawable/btn_notification_emphasized.xml | 6 +-- ...otification_material_action_emphasized.xml | 3 +- core/res/res/values/dimens.xml | 8 ++-- 6 files changed, 33 insertions(+), 70 deletions(-) diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 2dcdd07c99462..c6847aac0ceaf 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -5662,11 +5662,6 @@ public class Notification implements Parcelable R.dimen.call_notification_collapsible_indent); } big.setBoolean(R.id.actions, "setEmphasizedMode", emphazisedMode); - if (p.mCallStyleActions) { - // Use "wrap_content" (unlike normal emphasized mode) and allow prioritizing the - // required actions (Answer, Decline, and Hang Up). - big.setBoolean(R.id.actions, "setPrioritizedWrapMode", true); - } if (numActions > 0 && !p.mHideActions) { big.setViewVisibility(R.id.actions_container, View.VISIBLE); big.setViewVisibility(R.id.actions, View.VISIBLE); @@ -5683,7 +5678,7 @@ public class Notification implements Parcelable // Clear the drawable button.setInt(R.id.action0, "setBackgroundResource", 0); } - if (p.mCallStyleActions && i > 0) { + if (emphazisedMode && i > 0) { // Clear start margin from non-first buttons to reduce the gap between them. // (8dp remaining gap is from all buttons' standard 4dp inset). button.setViewLayoutMarginDimen(R.id.action0, RemoteViews.MARGIN_START, 0); @@ -6103,26 +6098,21 @@ public class Notification implements Parcelable // change the background bgColor CharSequence title = action.title; ColorStateList[] outResultColor = new ColorStateList[1]; - int background = getBackgroundColor(p); + int background = getSecondaryAccentColor(p); if (isLegacy()) { title = ContrastColorUtil.clearColorSpans(title); } else { title = ensureColorSpanContrast(title, background, outResultColor); } button.setTextViewText(R.id.action0, processTextSpans(title)); - final int textColor; boolean hasColorOverride = outResultColor[0] != null; if (hasColorOverride) { // There's a span spanning the full text, let's take it and use it as the // background color background = outResultColor[0].getDefaultColor(); - textColor = ContrastColorUtil.resolvePrimaryColor(mContext, - background, mInNightMode); - } else if (mTintActionButtons && !mInNightMode && !isBackgroundColorized(p)) { - textColor = getAccentColor(p); - } else { - textColor = getPrimaryTextColor(p); } + final int textColor = ContrastColorUtil.resolvePrimaryColor(mContext, + background, mInNightMode); button.setTextColor(R.id.action0, textColor); // We only want about 20% alpha for the ripple final int rippleColor = (textColor & 0x00ffffff) | 0x33000000; @@ -6130,11 +6120,10 @@ public class Notification implements Parcelable ColorStateList.valueOf(rippleColor)); button.setColorStateList(R.id.action0, "setButtonBackground", ColorStateList.valueOf(background)); - button.setBoolean(R.id.action0, "setHasStroke", !hasColorOverride); if (p.mCallStyleActions) { button.setImageViewIcon(R.id.action0, action.getIcon()); boolean priority = action.getExtras().getBoolean(CallStyle.KEY_ACTION_PRIORITY); - button.setBoolean(R.id.action0, "setWrapModePriority", priority); + button.setBoolean(R.id.action0, "setIsPriority", priority); int minWidthDimen = priority ? R.dimen.call_notification_system_action_min_width : 0; button.setIntDimen(R.id.action0, "setMinimumWidth", minWidthDimen); @@ -6319,6 +6308,22 @@ public class Notification implements Parcelable return getContrastColor(p); } + /** + * Gets the secondary accent color for colored UI elements. If we're tinting with the theme + * accent, this is the theme accent color, otherwise this would be identical to + * {@link #getSmallIconColor(StandardTemplateParams)}. + */ + private @ColorInt int getSecondaryAccentColor(StandardTemplateParams p) { + if (isBackgroundColorized(p)) { + return getSecondaryTextColor(p); + } + int color = obtainThemeColor(R.attr.colorAccentSecondary, COLOR_INVALID); + if (color != COLOR_INVALID) { + return color; + } + return getContrastColor(p); + } + /** * Gets the "surface protection" color from the theme, or a variant of the normal background * color when colorized, or when not using theme color tints. diff --git a/core/java/com/android/internal/widget/EmphasizedNotificationButton.java b/core/java/com/android/internal/widget/EmphasizedNotificationButton.java index 058a9218def45..4460e4a0ea781 100644 --- a/core/java/com/android/internal/widget/EmphasizedNotificationButton.java +++ b/core/java/com/android/internal/widget/EmphasizedNotificationButton.java @@ -27,9 +27,7 @@ import android.graphics.drawable.Icon; import android.graphics.drawable.RippleDrawable; import android.util.AttributeSet; import android.view.RemotableViewMethod; -import android.view.ViewGroup; import android.widget.Button; -import android.widget.LinearLayout; import android.widget.RemoteViews; import com.android.internal.R; @@ -42,8 +40,6 @@ import com.android.internal.R; @RemoteViews.RemoteView public class EmphasizedNotificationButton extends Button { private final RippleDrawable mRipple; - private final int mStrokeWidth; - private final int mStrokeColor; private boolean mPriority; public EmphasizedNotificationButton(Context context) { @@ -63,9 +59,6 @@ public class EmphasizedNotificationButton extends Button { super(context, attrs, defStyleAttr, defStyleRes); DrawableWrapper background = (DrawableWrapper) getBackground().mutate(); mRipple = (RippleDrawable) background.getDrawable(); - mStrokeWidth = getResources().getDimensionPixelSize( - com.android.internal.R.dimen.emphasized_button_stroke_width); - mStrokeColor = getContext().getColor(com.android.internal.R.color.material_grey_300); mRipple.mutate(); } @@ -82,13 +75,6 @@ public class EmphasizedNotificationButton extends Button { invalidate(); } - @RemotableViewMethod - public void setHasStroke(boolean hasStroke) { - GradientDrawable inner = (GradientDrawable) mRipple.getDrawable(0); - inner.setStroke(hasStroke ? mStrokeWidth : 0, mStrokeColor); - invalidate(); - } - /** * Sets an image icon which will have its size constrained and will be set to the same color as * the text. Must be called after {@link #setTextColor(int)} for the latter to work. @@ -121,18 +107,13 @@ public class EmphasizedNotificationButton extends Button { } /** - * Changes the LayoutParams.width to WRAP_CONTENT, with the argument representing if this view - * is a priority over its peers (which affects weight). + * Sets whether this view is a priority over its peers (which affects width). + * Specifically, this is used by {@link NotificationActionListLayout} to give this view width + * priority ahead of user-defined buttons when allocating horizontal space. */ @RemotableViewMethod - public void setWrapModePriority(boolean priority) { + public void setIsPriority(boolean priority) { mPriority = priority; - ViewGroup.LayoutParams layoutParams = getLayoutParams(); - layoutParams.width = ViewGroup.LayoutParams.WRAP_CONTENT; - if (layoutParams instanceof LinearLayout.LayoutParams) { - ((LinearLayout.LayoutParams) layoutParams).weight = 0; - } - setLayoutParams(layoutParams); } /** diff --git a/core/java/com/android/internal/widget/NotificationActionListLayout.java b/core/java/com/android/internal/widget/NotificationActionListLayout.java index 8e6497b204c78..ea7188840aa2b 100644 --- a/core/java/com/android/internal/widget/NotificationActionListLayout.java +++ b/core/java/com/android/internal/widget/NotificationActionListLayout.java @@ -46,7 +46,6 @@ public class NotificationActionListLayout extends LinearLayout { private ArrayList> mMeasureOrderTextViews = new ArrayList<>(); private ArrayList mMeasureOrderOther = new ArrayList<>(); private boolean mEmphasizedMode; - private boolean mPrioritizedWrapMode; private int mDefaultPaddingBottom; private int mDefaultPaddingTop; private int mEmphasizedHeight; @@ -72,10 +71,6 @@ public class NotificationActionListLayout extends LinearLayout { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - if (mEmphasizedMode && !mPrioritizedWrapMode) { - super.onMeasure(widthMeasureSpec, heightMeasureSpec); - return; - } final int N = getChildCount(); int textViews = 0; int otherViews = 0; @@ -175,8 +170,7 @@ public class NotificationActionListLayout extends LinearLayout { final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { View c = getChildAt(i); - if (c instanceof EmphasizedNotificationButton - && ((EmphasizedNotificationButton) c).isPriority()) { + if (isPriority(c)) { // add with 0 length to ensure that this view is measured before others. mMeasureOrderTextViews.add(Pair.create(0, (TextView) c)); } else if (c instanceof TextView && ((TextView) c).getText().length() > 0) { @@ -213,10 +207,6 @@ public class NotificationActionListLayout extends LinearLayout { @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { - if (mEmphasizedMode && !mPrioritizedWrapMode) { - super.onLayout(changed, left, top, right, bottom); - return; - } final boolean isLayoutRtl = isLayoutRtl(); final int paddingTop = mPaddingTop; final boolean centerAligned = (mGravity & Gravity.CENTER_HORIZONTAL) != 0; @@ -292,16 +282,6 @@ public class NotificationActionListLayout extends LinearLayout { com.android.internal.R.dimen.notification_action_list_height); } - /** - * When used with emphasizedMode, changes the button sizing behavior to prioritize certain - * buttons (which are system generated) to not scrunch, and leave the remaining space for - * custom actions. - */ - @RemotableViewMethod - public void setPrioritizedWrapMode(boolean prioritizedWrapMode) { - mPrioritizedWrapMode = prioritizedWrapMode; - } - /** * When buttons are in wrap mode, this is a padding that will be applied at the start of the * layout of the actions, but only when those actions would fit with the entire padding diff --git a/core/res/res/drawable/btn_notification_emphasized.xml b/core/res/res/drawable/btn_notification_emphasized.xml index ad680549aaa1c..63707ab7f5d69 100644 --- a/core/res/res/drawable/btn_notification_emphasized.xml +++ b/core/res/res/drawable/btn_notification_emphasized.xml @@ -24,13 +24,11 @@ - - diff --git a/core/res/res/layout/notification_material_action_emphasized.xml b/core/res/res/layout/notification_material_action_emphasized.xml index cd1f1ab88c96c..ea841851cd443 100644 --- a/core/res/res/layout/notification_material_action_emphasized.xml +++ b/core/res/res/layout/notification_material_action_emphasized.xml @@ -18,10 +18,9 @@ xmlns:android="http://schemas.android.com/apk/res/android" style="@style/NotificationEmphasizedAction" android:id="@+id/action0" - android:layout_width="match_parent" + android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginStart="12dp" - android:layout_weight="1" android:drawablePadding="6dp" android:gravity="center" android:textColor="@color/notification_default_color" diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index 4f90a174fef76..d3343060a8197 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -224,14 +224,14 @@ 56dp - + 60dp 0dp - - 48dp + + 36dp @@ -252,7 +252,7 @@ 20dp - 8dp + 18dp 1dp From c6d567d2399a2e6514f961c04416c8e1f263a428 Mon Sep 17 00:00:00 2001 From: Jeff DeCew Date: Mon, 10 May 2021 12:12:21 -0400 Subject: [PATCH 2/4] Fix measure logic so that priority children can have more than 1/N space. The priority previously just put the view at the front of the list, which ensured that super long user-provided actions couldn't cause the priority action at the end to be truncated. However, this still meant that a priority action at the start whose text would have it be longer than 1/3 of the action space would be capped at 1/3 instead of taking on some of the user-defined child's space. Bug: 187533622 Test: Post Notify2 app's Call style w/ Screen action; notice that "Decline" is not truncated. Change-Id: Ia18b2dc366ba7cac13ed845acac59d89206e7d5e --- .../widget/NotificationActionListLayout.java | 76 +++++++++++++++---- 1 file changed, 61 insertions(+), 15 deletions(-) diff --git a/core/java/com/android/internal/widget/NotificationActionListLayout.java b/core/java/com/android/internal/widget/NotificationActionListLayout.java index ea7188840aa2b..a4d6a60521171 100644 --- a/core/java/com/android/internal/widget/NotificationActionListLayout.java +++ b/core/java/com/android/internal/widget/NotificationActionListLayout.java @@ -17,11 +17,11 @@ package com.android.internal.widget; import android.annotation.DimenRes; +import android.app.Notification; import android.content.Context; import android.content.res.TypedArray; import android.graphics.drawable.RippleDrawable; import android.util.AttributeSet; -import android.util.Pair; import android.view.Gravity; import android.view.RemotableViewMethod; import android.view.View; @@ -43,7 +43,7 @@ public class NotificationActionListLayout extends LinearLayout { private final int mGravity; private int mTotalWidth = 0; private int mExtraStartPadding = 0; - private ArrayList> mMeasureOrderTextViews = new ArrayList<>(); + private ArrayList mMeasureOrderTextViews = new ArrayList<>(); private ArrayList mMeasureOrderOther = new ArrayList<>(); private boolean mEmphasizedMode; private int mDefaultPaddingBottom; @@ -69,12 +69,18 @@ public class NotificationActionListLayout extends LinearLayout { ta.recycle(); } + private static boolean isPriority(View actionView) { + return actionView instanceof EmphasizedNotificationButton + && ((EmphasizedNotificationButton) actionView).isPriority(); + } + @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { final int N = getChildCount(); int textViews = 0; int otherViews = 0; int notGoneChildren = 0; + int priorityChildren = 0; for (int i = 0; i < N; i++) { View c = getChildAt(i); @@ -85,6 +91,9 @@ public class NotificationActionListLayout extends LinearLayout { } if (c.getVisibility() != GONE) { notGoneChildren++; + if (isPriority(c)) { + priorityChildren++; + } } } @@ -98,9 +107,9 @@ public class NotificationActionListLayout extends LinearLayout { if (!needRebuild) { final int size = mMeasureOrderTextViews.size(); for (int i = 0; i < size; i++) { - Pair pair = mMeasureOrderTextViews.get(i); - if (pair.first != pair.second.getText().length()) { + if (mMeasureOrderTextViews.get(i).needsRebuild()) { needRebuild = true; + break; } } } @@ -117,14 +126,19 @@ public class NotificationActionListLayout extends LinearLayout { int usedWidth = 0; int measuredChildren = 0; + int measuredPriorityChildren = 0; for (int i = 0; i < N; i++) { // Measure shortest children first. To avoid measuring twice, we approximate by looking // at the text length. - View c; + final boolean isPriority; + final View c; if (i < otherSize) { c = mMeasureOrderOther.get(i); + isPriority = false; } else { - c = mMeasureOrderTextViews.get(i - otherSize).second; + TextViewInfo info = mMeasureOrderTextViews.get(i - otherSize); + c = info.mTextView; + isPriority = info.mIsPriority; } if (c.getVisibility() == GONE) { continue; @@ -138,7 +152,18 @@ public class NotificationActionListLayout extends LinearLayout { // measure in the order of (approx.) size, a large view can still take more than its // share if the others are small. int availableWidth = innerWidth - usedWidth; - int maxWidthForChild = availableWidth / (notGoneChildren - measuredChildren); + int unmeasuredChildren = notGoneChildren - measuredChildren; + int maxWidthForChild = availableWidth / unmeasuredChildren; + if (isPriority) { + // Priority children get a larger maximum share of the total space: + // maximum priority share = (nPriority + 1) / (MAX + 1) + int unmeasuredPriorityChildren = priorityChildren - measuredPriorityChildren; + int unmeasuredOtherChildren = unmeasuredChildren - unmeasuredPriorityChildren; + int widthReservedForOtherChildren = innerWidth * unmeasuredOtherChildren + / (Notification.MAX_ACTION_BUTTONS + 1); + int widthAvailableForPriority = availableWidth - widthReservedForOtherChildren; + maxWidthForChild = widthAvailableForPriority / unmeasuredPriorityChildren; + } usedWidthForChild = innerWidth - maxWidthForChild; } @@ -148,6 +173,9 @@ public class NotificationActionListLayout extends LinearLayout { usedWidth += c.getMeasuredWidth() + lp.rightMargin + lp.leftMargin; measuredChildren++; + if (isPriority) { + measuredPriorityChildren++; + } } int collapsibleIndent = mCollapsibleIndentDimen == 0 ? 0 @@ -170,12 +198,8 @@ public class NotificationActionListLayout extends LinearLayout { final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { View c = getChildAt(i); - if (isPriority(c)) { - // add with 0 length to ensure that this view is measured before others. - mMeasureOrderTextViews.add(Pair.create(0, (TextView) c)); - } else if (c instanceof TextView && ((TextView) c).getText().length() > 0) { - mMeasureOrderTextViews.add(Pair.create(((TextView) c).getText().length(), - (TextView)c)); + if (c instanceof TextView && ((TextView) c).getText().length() > 0) { + mMeasureOrderTextViews.add(new TextViewInfo((TextView) c)); } else { mMeasureOrderOther.add(c); } @@ -333,6 +357,28 @@ public class NotificationActionListLayout extends LinearLayout { return 0; } - public static final Comparator> MEASURE_ORDER_COMPARATOR - = (a, b) -> a.first.compareTo(b.first); + public static final Comparator MEASURE_ORDER_COMPARATOR = (a, b) -> { + int priorityComparison = -Boolean.compare(a.mIsPriority, b.mIsPriority); + return priorityComparison != 0 + ? priorityComparison + : Integer.compare(a.mTextLength, b.mTextLength); + }; + + private static final class TextViewInfo { + final boolean mIsPriority; + final int mTextLength; + final TextView mTextView; + + TextViewInfo(TextView textView) { + this.mIsPriority = isPriority(textView); + this.mTextLength = textView.getText().length(); + this.mTextView = textView; + } + + boolean needsRebuild() { + return mTextView.getText().length() != mTextLength + || isPriority(mTextView) != mIsPriority; + } + } + } From 0ffd1564d144748edcdf97d72a5064c1e5c41f1c Mon Sep 17 00:00:00 2001 From: Jeff DeCew Date: Mon, 10 May 2021 16:33:23 -0400 Subject: [PATCH 3/4] Smart action buttons now have 8dp corner radius Bug: 187533622 Test: manual/visual testing Change-Id: I49461363ca5171ff6346b602bf9e90e4bab92c53 --- packages/SystemUI/res/values/dimens.xml | 6 ++--- .../statusbar/policy/SmartReplyView.java | 23 ------------------- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index c60ec78053eec..24a3baf07e157 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -1148,14 +1148,14 @@ 8dp 14dp - 20dp - 19dp + 16dp + 15dp 48dp 1dp 14sp 6sp - 24dp + 8dp 18dp 8dp 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 edec61832c8e5..9e1ae8b89fc31 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java @@ -378,12 +378,6 @@ public class SmartReplyView extends ViewGroup { int buttonHeight = Math.max(getSuggestedMinimumHeight(), mPaddingTop + accumulatedMeasures.mMaxChildHeight + mPaddingBottom); - // Set the corner radius to half the button height to make the side of the buttons look like - // a semicircle. - for (View smartSuggestionButton : smartSuggestions) { - setCornerRadius((Button) smartSuggestionButton, ((float) buttonHeight) / 2); - } - setMeasuredDimension( resolveSize(Math.max(getSuggestedMinimumWidth(), accumulatedMeasures.mMeasuredWidth), @@ -725,23 +719,6 @@ public class SmartReplyView extends ViewGroup { button.setTextColor(mCurrentTextColor); } - private void setCornerRadius(Button button, float radius) { - Drawable drawable = button.getBackground(); - if (drawable instanceof RippleDrawable) { - // Mutate in case other notifications are using this drawable. - drawable = drawable.mutate(); - RippleDrawable ripple = (RippleDrawable) drawable; - Drawable inset = ripple.getDrawable(0); - if (inset instanceof InsetDrawable) { - Drawable background = ((InsetDrawable) inset).getDrawable(); - if (background instanceof GradientDrawable) { - GradientDrawable gradientDrawable = (GradientDrawable) background; - gradientDrawable.setCornerRadius(radius); - } - } - } - } - enum SmartButtonType { REPLY, ACTION From df7223b8e0850b9265987181983dd7be3b39ea80 Mon Sep 17 00:00:00 2001 From: Jeff DeCew Date: Mon, 10 May 2021 17:43:28 -0400 Subject: [PATCH 4/4] 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