Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ffd1564 authored by Jeff DeCew's avatar Jeff DeCew
Browse files

Smart action buttons now have 8dp corner radius

Bug: 187533622
Test: manual/visual testing

Change-Id: I49461363ca5171ff6346b602bf9e90e4bab92c53
parent c6d567d2
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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>

+0 −23
Original line number Diff line number Diff line
@@ -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