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

Commit a6203ca7 authored by Andy Mast's avatar Andy Mast Committed by Clark Scheff
Browse files

Themes: Allow notification shadows to be rounded

If a theme has a very large rounded rectangle it is obvious
the notification's shadow is a rectangle. So this patch
set the shadow to be drawn as a rounded rect like the notification itself.

Change-Id: I560fc5c4a4ce3d052d98b14af978a28c13b6caca
parent 8dffc868
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -148,6 +148,9 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
        mNormalColor = context.getColor(R.color.notification_material_background_color);
        mLowPriorityColor = context.getColor(
                R.color.notification_material_background_low_priority_color);
        int roundedRectCornerRadius = getResources().getDimensionPixelSize(
                R.dimen.notification_material_rounded_rect_radius);
        setRoundCornerRadius(roundedRectCornerRadius); // Themes: For drop-shadow rounded corners
        mTintedRippleColor = context.getColor(
                R.color.notification_ripple_tinted_color);
        mLowPriorityRippleColor = context.getColor(
+7 −3
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ public abstract class ExpandableOutlineView extends ExpandableView {
    private final Rect mOutlineRect = new Rect();
    protected final int mRoundedRectCornerRadius;
    private boolean mCustomOutline;
    private float mRoundCornerRadius = 0;

    public ExpandableOutlineView(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -43,12 +44,12 @@ public abstract class ExpandableOutlineView extends ExpandableView {
            @Override
            public void getOutline(View view, Outline outline) {
                if (!mCustomOutline) {
                    outline.setRect(0,
                    outline.setRoundRect(0,
                            mClipTopAmount,
                            getWidth(),
                            Math.max(getActualHeight(), mClipTopAmount));
                            Math.max(getActualHeight(), mClipTopAmount), mRoundCornerRadius);
                } else {
                    outline.setRoundRect(mOutlineRect, mRoundedRectCornerRadius);
                    outline.setRoundRect(mOutlineRect, mRoundCornerRadius);
                }
            }
        });
@@ -89,4 +90,7 @@ public abstract class ExpandableOutlineView extends ExpandableView {
        invalidateOutline();
    }

    protected void setRoundCornerRadius(float roundRadius) {
        mRoundCornerRadius = roundRadius;
    }
}