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

Commit b0c2138e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix emphasized button drawable to avoid ripple shape glitch." into sc-dev am: fee0ac21

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15017990

Change-Id: I72ff141203838d83375258e075f6a2b2ce05f889
parents 5643e20d fee0ac21
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import com.android.internal.R;
@RemoteViews.RemoteView
public class EmphasizedNotificationButton extends Button {
    private final RippleDrawable mRipple;
    private final GradientDrawable mBackground;
    private boolean mPriority;

    public EmphasizedNotificationButton(Context context) {
@@ -57,9 +58,10 @@ public class EmphasizedNotificationButton extends Button {
    public EmphasizedNotificationButton(Context context, AttributeSet attrs, int defStyleAttr,
            int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
        DrawableWrapper background = (DrawableWrapper) getBackground().mutate();
        mRipple = (RippleDrawable) background.getDrawable();
        mRipple = (RippleDrawable) getBackground();
        mRipple.mutate();
        DrawableWrapper inset = (DrawableWrapper) mRipple.getDrawable(0);
        mBackground = (GradientDrawable) inset.getDrawable();
    }

    @RemotableViewMethod
@@ -70,8 +72,7 @@ public class EmphasizedNotificationButton extends Button {

    @RemotableViewMethod
    public void setButtonBackground(ColorStateList color) {
        GradientDrawable inner = (GradientDrawable) mRipple.getDrawable(0);
        inner.setColor(color);
        mBackground.setColor(color);
        invalidate();
    }

+10 −10
Original line number Diff line number Diff line
@@ -15,13 +15,13 @@
  ~ limitations under the License
  -->

<inset xmlns:android="http://schemas.android.com/apk/res/android"
<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?attr/colorControlHighlight">
    <item>
        <inset
            android:insetLeft="@dimen/button_inset_horizontal_material"
            android:insetTop="@dimen/button_inset_vertical_material"
            android:insetRight="@dimen/button_inset_horizontal_material"
            android:insetBottom="@dimen/button_inset_vertical_material">
    <ripple android:color="?attr/colorControlHighlight">
        <item>
            <shape android:shape="rectangle">
                <corners android:radius="@dimen/notification_action_button_radius" />
                <padding android:left="12dp"
@@ -30,6 +30,6 @@
                         android:bottom="@dimen/button_padding_vertical_material" />
                <solid android:color="@color/white" />
            </shape>
        </inset>
    </item>
</ripple>
</inset>