diff options
6 files changed, 19 insertions, 29 deletions
diff --git a/packages/SystemUI/res/layout/smart_action_button.xml b/packages/SystemUI/res/layout/smart_action_button.xml index 488be3a4479e..4e5785d284ee 100644 --- a/packages/SystemUI/res/layout/smart_action_button.xml +++ b/packages/SystemUI/res/layout/smart_action_button.xml @@ -29,8 +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:paddingStart="@dimen/smart_reply_button_action_padding_left" + android:paddingEnd="@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 ddf16e0afed7..b24362febbdd 100644 --- a/packages/SystemUI/res/layout/smart_reply_button.xml +++ b/packages/SystemUI/res/layout/smart_reply_button.xml @@ -31,7 +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:paddingStart="@dimen/smart_reply_button_padding_horizontal" + android:paddingEnd="@dimen/smart_reply_button_padding_horizontal" android:textStyle="normal" android:ellipsize="none"/> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java index 4522e41daf91..b4bfded58e4b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java @@ -966,7 +966,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder @Override public ApplicationInfo getApplicationInfo() { - ApplicationInfo applicationInfo = super.getApplicationInfo(); + ApplicationInfo applicationInfo = new ApplicationInfo(super.getApplicationInfo()); applicationInfo.flags |= ApplicationInfo.FLAG_SUPPORTS_RTL; return applicationInfo; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyStateInflater.kt b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyStateInflater.kt index b563d86f65b1..21d03386b9e2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyStateInflater.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyStateInflater.kt @@ -311,7 +311,7 @@ interface SmartActionInflater { setBounds(0, 0, newIconSize, newIconSize) } // Add the action icon to the Smart Action button. - setCompoundDrawables(iconDrawable, null, null, null) + setCompoundDrawablesRelative(iconDrawable, null, null, null) val onClickListener = View.OnClickListener { onSmartActionClick(entry, smartActions, actionIndex, action) 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 9e88ceb3a0d1..fb6ba8542a3f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java @@ -588,15 +588,15 @@ public class SmartReplyView extends ViewGroup { } /** - * Returns the combined width of the left drawable (the action icon) and the padding between the - * drawable and the button text. + * Returns the combined width of the start drawable (the action icon) and the padding between + * the drawable and the button text. */ - private int getLeftCompoundDrawableWidthWithPadding(Button button) { - Drawable[] drawables = button.getCompoundDrawables(); - Drawable leftDrawable = drawables[0]; - if (leftDrawable == null) return 0; + private int getStartCompoundDrawableWidthWithPadding(Button button) { + Drawable[] drawables = button.getCompoundDrawablesRelative(); + Drawable startDrawable = drawables[0]; + if (startDrawable == null) return 0; - return leftDrawable.getBounds().width() + button.getCompoundDrawablePadding(); + return startDrawable.getBounds().width() + button.getCompoundDrawablePadding(); } private int squeezeButtonToTextWidth(Button button, int heightMeasureSpec, int textWidth) { @@ -605,8 +605,8 @@ public class SmartReplyView extends ViewGroup { // Re-measure the squeezed smart reply button. clearLayoutLineCount(button); final int widthMeasureSpec = MeasureSpec.makeMeasureSpec( - button.getPaddingLeft() + button.getPaddingRight() + textWidth - + getLeftCompoundDrawableWidthWithPadding(button), MeasureSpec.AT_MOST); + button.getPaddingStart() + button.getPaddingEnd() + textWidth + + getStartCompoundDrawableWidthWithPadding(button), MeasureSpec.AT_MOST); button.measure(widthMeasureSpec, heightMeasureSpec); if (button.getLayout() == null) { Log.wtf(TAG, "Button layout is null after measure."); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java index d9d8b6345fcb..3b0d5120cca3 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java @@ -585,8 +585,6 @@ public class SmartReplyViewTest extends SysuiTestCase { // devices. layout.setBaselineAligned(false); - final boolean isRtl = mView.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; - // Add smart replies Button previous = null; SmartReplyView.SmartReplies smartReplies = @@ -606,11 +604,7 @@ public class SmartReplyViewTest extends SysuiTestCase { if (previous != null) { ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) previous.getLayoutParams(); - if (isRtl) { - lp.leftMargin = mSpacing; - } else { - lp.rightMargin = mSpacing; - } + lp.setMarginEnd(mSpacing); } layout.addView(current); previous = current; @@ -634,11 +628,7 @@ public class SmartReplyViewTest extends SysuiTestCase { if (previous != null) { ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) previous.getLayoutParams(); - if (isRtl) { - lp.leftMargin = mSpacing; - } else { - lp.rightMargin = mSpacing; - } + lp.setMarginEnd(mSpacing); } layout.addView(current); previous = current; @@ -937,8 +927,8 @@ public class SmartReplyViewTest extends SysuiTestCase { .collect(Collectors.toList()); Button singleLineButton = buttons.get(0); Button doubleLineButton = buttons.get(1); - Drawable singleLineDrawable = singleLineButton.getCompoundDrawables()[0]; // left drawable - Drawable doubleLineDrawable = doubleLineButton.getCompoundDrawables()[0]; // left drawable + Drawable singleLineDrawable = singleLineButton.getCompoundDrawablesRelative()[0]; // start + Drawable doubleLineDrawable = doubleLineButton.getCompoundDrawablesRelative()[0]; // start assertEquals(singleLineDrawable.getBounds().width(), doubleLineDrawable.getBounds().width()); assertEquals(singleLineDrawable.getBounds().height(), |