Smart action buttons now have 8dp corner radius

Bug: 187533622
Test: manual/visual testing

Change-Id: I49461363ca5171ff6346b602bf9e90e4bab92c53
This commit is contained in:
Jeff DeCew
2021-05-10 16:33:23 -04:00
parent c6d567d239
commit 0ffd1564d1
2 changed files with 3 additions and 26 deletions

View File

@@ -1148,14 +1148,14 @@
<dimen name="smart_reply_button_spacing">8dp</dimen>
<dimen name="smart_reply_button_padding_vertical">14dp</dimen>
<!-- Note: The following two paddings need to be different until b/78876518 is fixed. -->
<dimen name="smart_reply_button_padding_horizontal_single_line">20dp</dimen>
<dimen name="smart_reply_button_padding_horizontal_double_line">19dp</dimen>
<dimen name="smart_reply_button_padding_horizontal_single_line">16dp</dimen>
<dimen name="smart_reply_button_padding_horizontal_double_line">15dp</dimen>
<dimen name="smart_reply_button_min_height">48dp</dimen>
<dimen name="smart_reply_button_stroke_width">1dp</dimen>
<dimen name="smart_reply_button_font_size">14sp</dimen>
<dimen name="smart_reply_button_line_spacing_extra">6sp</dimen> <!-- Total line height 20sp. -->
<!-- Corner radius = half of min_height to create rounded sides. -->
<dimen name="smart_reply_button_corner_radius">24dp</dimen>
<dimen name="smart_reply_button_corner_radius">8dp</dimen>
<dimen name="smart_action_button_icon_size">18dp</dimen>
<dimen name="smart_action_button_icon_padding">8dp</dimen>

View File

@@ -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