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

Commit d1e40028 authored by Andy Mast's avatar Andy Mast Committed by Abhisek Devkota
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 f840184a
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -19,4 +19,10 @@
     <dimen name="detail_radio_group_padding_left">16dp</dimen>
     <dimen name="detail_radio_group_padding">8dp</dimen>
    <dimen name="qs_tile_icon_size_visualizer">40dp</dimen>

    <!-- Themes: radius of the corners of the notification dropshadow
         See also: notification_material_rounded_rect_radius
    -->
    <dimen name="notification_material_shadow_rounded_rect_radius">0dp</dimen>

</resources>
+1 −0
Original line number Diff line number Diff line
@@ -151,6 +151,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
        mAppearAnimationFilter = new PorterDuffColorFilter(0, PorterDuff.Mode.SRC_ATOP);
        mRoundedRectCornerRadius = getResources().getDimensionPixelSize(
                R.dimen.notification_material_rounded_rect_radius);
        setRoundCornerRadius(mRoundedRectCornerRadius); // Themes: For drop-shadow rounded corners
        mLegacyColor = getResources().getColor(R.color.notification_legacy_background_color);
        mNormalColor = getResources().getColor(R.color.notification_material_background_color);
        mLowPriorityColor = getResources().getColor(
+7 −3
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ public abstract class ExpandableOutlineView extends ExpandableView {

    private final Rect mOutlineRect = new Rect();
    private boolean mCustomOutline;
    private float mRoundCornerRadius = 0;

    public ExpandableOutlineView(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -38,12 +39,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(mActualHeight, mClipTopAmount));
                            Math.max(mActualHeight, mClipTopAmount), mRoundCornerRadius);
                } else {
                    outline.setRect(mOutlineRect);
                    outline.setRoundRect(mOutlineRect, mRoundCornerRadius);
                }
            }
        });
@@ -82,4 +83,7 @@ public abstract class ExpandableOutlineView extends ExpandableView {
        invalidateOutline();
    }

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