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

Commit b95fd185 authored by Selim Cinek's avatar Selim Cinek
Browse files

Made the notification side paddings consistent

The rounding and paddings are now consistent
throughout the shade. Before the notifications
were only rounded on the top, but the design
didn't work perfectly in all situations.

Bug: 69168591
Test: add notifications, observe consistent paddings
Change-Id: Idc60cb7d448193c65f77bafebb2d110809ecb725
parent afeed29b
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -152,11 +152,11 @@
    <dimen name="dialog_padding">16dp</dimen>

    <!-- The margin on the start of the content view -->
    <dimen name="notification_content_margin_start">24dp</dimen>
    <dimen name="notification_content_margin_start">16dp</dimen>

    <!-- The margin on the end of the content view
        Keep in sync with notification_content_plus_picture_margin! -->
    <dimen name="notification_content_margin_end">24dp</dimen>
    <dimen name="notification_content_margin_end">16dp</dimen>

    <!-- The margin on the end of the content view with a picture.
        Keep in sync with notification_content_plus_picture_margin! -->
@@ -166,7 +166,7 @@
        content end margin.
        Keep equal to (notification_content_picture_margin + notification_content_margin_end)!
    -->
    <dimen name="notification_content_plus_picture_margin_end">80dp</dimen>
    <dimen name="notification_content_plus_picture_margin_end">72dp</dimen>

    <!-- The additional margin on the sides of the ambient view. -->
    <dimen name="notification_extra_margin_ambient">16dp</dimen>
+3 −6
Original line number Diff line number Diff line
@@ -102,10 +102,7 @@
    <dimen name="notification_max_heads_up_height_increased">188dp</dimen>

    <!-- Side padding on the lockscreen on the side of notifications -->
    <dimen name="notification_lockscreen_side_paddings">8dp</dimen>

    <!-- Additional side padding for custom content if the app doesn't target P yet -->
    <dimen name="notification_content_custom_view_side_padding">@dimen/notification_lockscreen_side_paddings</dimen>
    <dimen name="notification_side_paddings">4dp</dimen>

    <!-- Height of a messaging notifications with actions at least. Not that this is an upper bound
         and the notification won't use this much, but is measured with wrap_content -->
@@ -121,7 +118,7 @@
    <dimen name="notification_min_interaction_height">40dp</dimen>

    <!-- the padding of the shelf icon container -->
    <dimen name="shelf_icon_container_padding">21dp</dimen>
    <dimen name="shelf_icon_container_padding">13dp</dimen>

    <!-- The padding of a notification icon on top to the start of the notification. Used for custom
         views where the distance can't be measured -->
@@ -226,7 +223,7 @@
    <dimen name="qs_footer_height">48dp</dimen>

    <!-- The padding between the notifications and the quick settings container -->
    <dimen name="qs_notification_keyguard_padding">8dp</dimen>
    <dimen name="qs_notification_padding">@dimen/notification_side_paddings</dimen>

    <!-- Height of the status bar header bar when expanded -->
    <dimen name="status_bar_header_height_expanded">124dp</dimen>
+0 −4
Original line number Diff line number Diff line
@@ -86,10 +86,6 @@
    <item type="id" name="top_roundess_animator_start_tag"/>
    <item type="id" name="top_roundess_animator_end_tag"/>

    <item type="id" name="side_padding_animator_tag"/>
    <item type="id" name="side_padding_animator_start_tag"/>
    <item type="id" name="side_padding_animator_end_tag"/>

    <!-- Accessibility actions for the notification menu -->
    <item type="id" name="action_snooze_undo"/>
    <item type="id" name="action_snooze_shorter"/>
+0 −7
Original line number Diff line number Diff line
@@ -930,13 +930,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
        return calculateBgColor(true /* withTint */, true /* withOverRide */);
    }

    @Override
    public void setCurrentSidePaddings(float currentSidePaddings) {
        super.setCurrentSidePaddings(currentSidePaddings);
        mBackgroundNormal.setCurrentSidePaddings(currentSidePaddings);
        mBackgroundDimmed.setCurrentSidePaddings(currentSidePaddings);
    }

    @Override
    protected boolean childNeedsClipping(View child) {
        if (child instanceof NotificationBackgroundView && isClippingNeeded()) {
+5 −21
Original line number Diff line number Diff line
@@ -2362,16 +2362,15 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
            NotificationContentView contentView = (NotificationContentView) child;
            if (isClippingNeeded()) {
                return true;
            } else if (!hasNoRoundingAndNoPadding() && contentView.shouldClipToSidePaddings()) {
            } else if (!hasNoRounding() && contentView.shouldClipToRounding()) {
                return true;
            }
        } else if (child == mChildrenContainer) {
            if (isClippingNeeded() || ((isGroupExpanded() || isGroupExpansionChanging())
                    && getClipBottomAmount() != 0.0f && getCurrentBottomRoundness() != 0.0f)) {
            if (isClippingNeeded() || !hasNoRounding()) {
                return true;
            }
        } else if (child instanceof NotificationGuts) {
            return !hasNoRoundingAndNoPadding();
            return !hasNoRounding();
        }
        return super.childNeedsClipping(child);
    }
@@ -2401,9 +2400,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        return super.getCustomClipPath(child);
    }

    private boolean hasNoRoundingAndNoPadding() {
        return mCurrentSidePaddings == 0 && getCurrentBottomRoundness() == 0.0f
                && getCurrentTopRoundness() == 0.0f;
    private boolean hasNoRounding() {
        return getCurrentBottomRoundness() == 0.0f && getCurrentTopRoundness() == 0.0f;
    }

    public boolean isShowingAmbient() {
@@ -2418,20 +2416,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        }
    }

    @Override
    public void setCurrentSidePaddings(float currentSidePaddings) {
        if (mIsSummaryWithChildren) {
            List<ExpandableNotificationRow> notificationChildren =
                    mChildrenContainer.getNotificationChildren();
            int size = notificationChildren.size();
            for (int i = 0; i < size; i++) {
                ExpandableNotificationRow row = notificationChildren.get(i);
                row.setCurrentSidePaddings(currentSidePaddings);
            }
        }
        super.setCurrentSidePaddings(currentSidePaddings);
    }

    public static class NotificationViewState extends ExpandableViewState {

        private final StackScrollState mOverallState;
Loading