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

Commit 9b49f6de authored by Selim Cinek's avatar Selim Cinek
Browse files

Increased the notification paddings

The notifications now have slightly bigger paddings
for better readability and in order to support the
lockscreen redesign better.

Test: manual
Bug: 69168591
Change-Id: Ib5ddee5c1695387a162f64de10385b6c92a19761
parent d9b7dd4a
Loading
Loading
Loading
Loading
+9 −9
Original line number Original line Diff line number Diff line
@@ -152,11 +152,11 @@
    <dimen name="dialog_padding">16dp</dimen>
    <dimen name="dialog_padding">16dp</dimen>


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


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


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


    <!-- The additional margin on the sides of the ambient view. -->
    <!-- The additional margin on the sides of the ambient view. -->
    <dimen name="notification_extra_margin_ambient">16dp</dimen>
    <dimen name="notification_extra_margin_ambient">16dp</dimen>
@@ -175,10 +175,10 @@
    <dimen name="notification_action_list_height">56dp</dimen>
    <dimen name="notification_action_list_height">56dp</dimen>


    <!-- height of the content margin to accomodate for the header -->
    <!-- height of the content margin to accomodate for the header -->
    <dimen name="notification_content_margin_top">37.5dp</dimen>
    <dimen name="notification_content_margin_top">41.5dp</dimen>


    <!-- height of the content margin on the bottom -->
    <!-- height of the content margin on the bottom -->
    <dimen name="notification_content_margin_bottom">16dp</dimen>
    <dimen name="notification_content_margin_bottom">18dp</dimen>


    <!-- The height of the progress bar. -->
    <!-- The height of the progress bar. -->
    <dimen name="notification_progress_bar_height">15dp</dimen>
    <dimen name="notification_progress_bar_height">15dp</dimen>
@@ -187,16 +187,16 @@
    <dimen name="notification_progress_margin_top">8dp</dimen>
    <dimen name="notification_progress_margin_top">8dp</dimen>


    <!-- height of the notification header (for icon and package name) -->
    <!-- height of the notification header (for icon and package name) -->
    <dimen name="notification_header_height">48dp</dimen>
    <dimen name="notification_header_height">54dp</dimen>


    <!-- The height of the background for a notification header on a group -->
    <!-- The height of the background for a notification header on a group -->
    <dimen name="notification_header_background_height">45.5dp</dimen>
    <dimen name="notification_header_background_height">49.5dp</dimen>


    <!-- The top padding for the notification header -->
    <!-- The top padding for the notification header -->
    <dimen name="notification_header_padding_top">10dp</dimen>
    <dimen name="notification_header_padding_top">14dp</dimen>


    <!-- The bottom padding for the notification header -->
    <!-- The bottom padding for the notification header -->
    <dimen name="notification_header_padding_bottom">11dp</dimen>
    <dimen name="notification_header_padding_bottom">13dp</dimen>


    <!-- The margin at the bottom of the notification header. -->
    <!-- The margin at the bottom of the notification header. -->
    <dimen name="notification_header_margin_bottom">5dp</dimen>
    <dimen name="notification_header_margin_bottom">5dp</dimen>
+1 −1
Original line number Original line Diff line number Diff line
@@ -1304,7 +1304,7 @@ please see styles_device_defaults.xml.
        <item name="paddingBottom">@dimen/notification_header_padding_bottom</item>
        <item name="paddingBottom">@dimen/notification_header_padding_bottom</item>
        <item name="layout_marginBottom">@dimen/notification_header_margin_bottom</item>
        <item name="layout_marginBottom">@dimen/notification_header_margin_bottom</item>
        <item name="paddingStart">@dimen/notification_content_margin_start</item>
        <item name="paddingStart">@dimen/notification_content_margin_start</item>
        <item name="paddingEnd">16dp</item>
        <item name="paddingEnd">@dimen/notification_content_margin_end</item>
        <item name="gravity">top</item>
        <item name="gravity">top</item>
    </style>
    </style>


+14 −9
Original line number Original line Diff line number Diff line
@@ -72,16 +72,19 @@
    <dimen name="status_bar_connected_device_bt_indicator_size">17dp</dimen>
    <dimen name="status_bar_connected_device_bt_indicator_size">17dp</dimen>


    <!-- Height of a small notification in the status bar-->
    <!-- Height of a small notification in the status bar-->
    <dimen name="notification_min_height">92dp</dimen>
    <dimen name="notification_min_height">100dp</dimen>


    <!-- Increased height of a small notification in the status bar -->
    <!-- Increased height of a small notification in the status bar -->
    <dimen name="notification_min_height_increased">132dp</dimen>
    <dimen name="notification_min_height_increased">140dp</dimen>


    <!-- Height of a small notification in the status bar which was used before android N -->
    <!-- Height of a small notification in the status bar which was used before android N -->
    <dimen name="notification_min_height_legacy">64dp</dimen>
    <dimen name="notification_min_height_legacy">64dp</dimen>


    <!-- Height of a small notification in the status bar which was used before android P -->
    <dimen name="notification_min_height_before_p">92dp</dimen>

    <!-- Height of a large notification in the status bar -->
    <!-- Height of a large notification in the status bar -->
    <dimen name="notification_max_height">284dp</dimen>
    <dimen name="notification_max_height">292dp</dimen>


    <!-- Height of an ambient notification on ambient display -->
    <!-- Height of an ambient notification on ambient display -->
    <dimen name="notification_ambient_height">400dp</dimen>
    <dimen name="notification_ambient_height">400dp</dimen>
@@ -89,12 +92,18 @@
    <!-- Height of a heads up notification in the status bar for legacy custom views -->
    <!-- Height of a heads up notification in the status bar for legacy custom views -->
    <dimen name="notification_max_heads_up_height_legacy">128dp</dimen>
    <dimen name="notification_max_heads_up_height_legacy">128dp</dimen>


    <!-- Height of a heads up notification in the status bar for custom views before andoid P -->
    <dimen name="notification_max_heads_up_height_before_p">148dp</dimen>

    <!-- Height of a heads up notification in the status bar -->
    <!-- Height of a heads up notification in the status bar -->
    <dimen name="notification_max_heads_up_height">148dp</dimen>
    <dimen name="notification_max_heads_up_height">156dp</dimen>


    <!-- Height of a heads up notification in the status bar -->
    <!-- Height of a heads up notification in the status bar -->
    <dimen name="notification_max_heads_up_height_increased">188dp</dimen>
    <dimen name="notification_max_heads_up_height_increased">188dp</dimen>


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

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


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


    <!-- The padding of a notification icon on top to the start of the notification. Used for custom
    <!-- 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 -->
         views where the distance can't be measured -->
@@ -348,10 +357,6 @@
    <!-- Default distance from each snap target that GlowPadView considers a "hit" -->
    <!-- Default distance from each snap target that GlowPadView considers a "hit" -->
    <dimen name="glowpadview_inner_radius">15dip</dimen>
    <dimen name="glowpadview_inner_radius">15dip</dimen>


    <!-- bottom_stack_peek_amount + notification_min_height
         + notification_collapse_second_card_padding -->
    <dimen name="min_stack_height">104dp</dimen>

    <!-- Z distance between notifications if they are in the stack -->
    <!-- Z distance between notifications if they are in the stack -->
    <dimen name="z_distance_between_notifications">0.5dp</dimen>
    <dimen name="z_distance_between_notifications">0.5dp</dimen>


+12 −4
Original line number Original line Diff line number Diff line
@@ -102,7 +102,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    private int mIconTransformContentShift;
    private int mIconTransformContentShift;
    private int mIconTransformContentShiftNoIcon;
    private int mIconTransformContentShiftNoIcon;
    private int mNotificationMinHeightLegacy;
    private int mNotificationMinHeightLegacy;
    private int mNotificationMinHeightBeforeP;
    private int mMaxHeadsUpHeightLegacy;
    private int mMaxHeadsUpHeightLegacy;
    private int mMaxHeadsUpHeightBeforeP;
    private int mMaxHeadsUpHeight;
    private int mMaxHeadsUpHeight;
    private int mMaxHeadsUpHeightIncreased;
    private int mMaxHeadsUpHeightIncreased;
    private int mNotificationMinHeight;
    private int mNotificationMinHeight;
@@ -435,9 +437,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        boolean customView = layout.getContractedChild().getId()
        boolean customView = layout.getContractedChild().getId()
                != com.android.internal.R.id.status_bar_latest_event_content;
                != com.android.internal.R.id.status_bar_latest_event_content;
        boolean beforeN = mEntry.targetSdk < Build.VERSION_CODES.N;
        boolean beforeN = mEntry.targetSdk < Build.VERSION_CODES.N;
        boolean beforeP = mEntry.targetSdk < Build.VERSION_CODES.P;
        int minHeight;
        int minHeight;
        if (customView && beforeN && !mIsSummaryWithChildren) {
        if (customView && beforeP && !mIsSummaryWithChildren) {
            minHeight = mNotificationMinHeightLegacy;
            minHeight = beforeN ? mNotificationMinHeightLegacy : mNotificationMinHeightBeforeP;
        } else if (mUseIncreasedCollapsedHeight && layout == mPrivateLayout) {
        } else if (mUseIncreasedCollapsedHeight && layout == mPrivateLayout) {
            minHeight = mNotificationMinHeightLarge;
            minHeight = mNotificationMinHeightLarge;
        } else {
        } else {
@@ -447,8 +450,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
                layout.getHeadsUpChild().getId()
                layout.getHeadsUpChild().getId()
                        != com.android.internal.R.id.status_bar_latest_event_content;
                        != com.android.internal.R.id.status_bar_latest_event_content;
        int headsUpheight;
        int headsUpheight;
        if (headsUpCustom && beforeN) {
        if (headsUpCustom && beforeP) {
            headsUpheight = mMaxHeadsUpHeightLegacy;
            headsUpheight = beforeN ? mMaxHeadsUpHeightLegacy : mMaxHeadsUpHeightBeforeP;
        } else if (mUseIncreasedHeadsUpHeight && layout == mPrivateLayout) {
        } else if (mUseIncreasedHeadsUpHeight && layout == mPrivateLayout) {
            headsUpheight = mMaxHeadsUpHeightIncreased;
            headsUpheight = mMaxHeadsUpHeightIncreased;
        } else {
        } else {
@@ -916,6 +919,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
            addView(mMenuRow.getMenuView(), menuIndex);
            addView(mMenuRow.getMenuView(), menuIndex);
        }
        }
        for (NotificationContentView l : mLayouts) {
        for (NotificationContentView l : mLayouts) {
            l.initView();
            l.reInflateViews();
            l.reInflateViews();
        }
        }
        mNotificationInflater.onDensityOrFontScaleChanged();
        mNotificationInflater.onDensityOrFontScaleChanged();
@@ -1265,6 +1269,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    private void initDimens() {
    private void initDimens() {
        mNotificationMinHeightLegacy = NotificationUtils.getFontScaledHeight(mContext,
        mNotificationMinHeightLegacy = NotificationUtils.getFontScaledHeight(mContext,
                R.dimen.notification_min_height_legacy);
                R.dimen.notification_min_height_legacy);
        mNotificationMinHeightBeforeP = NotificationUtils.getFontScaledHeight(mContext,
                R.dimen.notification_min_height_before_p);
        mNotificationMinHeight = NotificationUtils.getFontScaledHeight(mContext,
        mNotificationMinHeight = NotificationUtils.getFontScaledHeight(mContext,
                R.dimen.notification_min_height);
                R.dimen.notification_min_height);
        mNotificationMinHeightLarge = NotificationUtils.getFontScaledHeight(mContext,
        mNotificationMinHeightLarge = NotificationUtils.getFontScaledHeight(mContext,
@@ -1275,6 +1281,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
                R.dimen.notification_ambient_height);
                R.dimen.notification_ambient_height);
        mMaxHeadsUpHeightLegacy = NotificationUtils.getFontScaledHeight(mContext,
        mMaxHeadsUpHeightLegacy = NotificationUtils.getFontScaledHeight(mContext,
                R.dimen.notification_max_heads_up_height_legacy);
                R.dimen.notification_max_heads_up_height_legacy);
        mMaxHeadsUpHeightBeforeP = NotificationUtils.getFontScaledHeight(mContext,
                R.dimen.notification_max_heads_up_height_before_p);
        mMaxHeadsUpHeight = NotificationUtils.getFontScaledHeight(mContext,
        mMaxHeadsUpHeight = NotificationUtils.getFontScaledHeight(mContext,
                R.dimen.notification_max_heads_up_height);
                R.dimen.notification_max_heads_up_height);
        mMaxHeadsUpHeightIncreased = NotificationUtils.getFontScaledHeight(mContext,
        mMaxHeadsUpHeightIncreased = NotificationUtils.getFontScaledHeight(mContext,
+50 −9
Original line number Original line Diff line number Diff line
@@ -58,9 +58,9 @@ public class NotificationContentView extends FrameLayout {
    public static final int UNDEFINED = -1;
    public static final int UNDEFINED = -1;


    private final Rect mClipBounds = new Rect();
    private final Rect mClipBounds = new Rect();
    private final int mMinContractedHeight;
    private final int mNotificationContentMarginEnd;


    private int mMinContractedHeight;
    private int mNotificationContentMarginEnd;
    private View mContractedChild;
    private View mContractedChild;
    private View mExpandedChild;
    private View mExpandedChild;
    private View mHeadsUpChild;
    private View mHeadsUpChild;
@@ -134,15 +134,22 @@ public class NotificationContentView extends FrameLayout {
    private int mClipBottomAmount;
    private int mClipBottomAmount;
    private boolean mIsLowPriority;
    private boolean mIsLowPriority;
    private boolean mIsContentExpandable;
    private boolean mIsContentExpandable;
    private int mCustomViewSidePaddings;




    public NotificationContentView(Context context, AttributeSet attrs) {
    public NotificationContentView(Context context, AttributeSet attrs) {
        super(context, attrs);
        super(context, attrs);
        mHybridGroupManager = new HybridGroupManager(getContext(), this);
        mHybridGroupManager = new HybridGroupManager(getContext(), this);
        initView();
    }

    public void initView() {
        mMinContractedHeight = getResources().getDimensionPixelSize(
        mMinContractedHeight = getResources().getDimensionPixelSize(
                R.dimen.min_notification_layout_height);
                R.dimen.min_notification_layout_height);
        mNotificationContentMarginEnd = getResources().getDimensionPixelSize(
        mNotificationContentMarginEnd = getResources().getDimensionPixelSize(
                com.android.internal.R.dimen.notification_content_margin_end);
                com.android.internal.R.dimen.notification_content_margin_end);
        mCustomViewSidePaddings = getResources().getDimensionPixelSize(
                R.dimen.notification_content_custom_view_side_padding);
    }
    }


    public void setHeights(int smallHeight, int headsUpMaxHeight, int maxHeight,
    public void setHeights(int smallHeight, int headsUpMaxHeight, int maxHeight,
@@ -178,7 +185,7 @@ public class NotificationContentView extends FrameLayout {
                    : MeasureSpec.makeMeasureSpec(size, useExactly
                    : MeasureSpec.makeMeasureSpec(size, useExactly
                            ? MeasureSpec.EXACTLY
                            ? MeasureSpec.EXACTLY
                            : MeasureSpec.AT_MOST);
                            : MeasureSpec.AT_MOST);
            mExpandedChild.measure(widthMeasureSpec, spec);
            measureChildWithMargins(mExpandedChild, widthMeasureSpec, 0, spec, 0);
            maxChildHeight = Math.max(maxChildHeight, mExpandedChild.getMeasuredHeight());
            maxChildHeight = Math.max(maxChildHeight, mExpandedChild.getMeasuredHeight());
        }
        }
        if (mContractedChild != null) {
        if (mContractedChild != null) {
@@ -196,22 +203,22 @@ public class NotificationContentView extends FrameLayout {
            } else {
            } else {
                heightSpec = MeasureSpec.makeMeasureSpec(size, MeasureSpec.AT_MOST);
                heightSpec = MeasureSpec.makeMeasureSpec(size, MeasureSpec.AT_MOST);
            }
            }
            mContractedChild.measure(widthMeasureSpec, heightSpec);
            measureChildWithMargins(mContractedChild, widthMeasureSpec, 0, heightSpec, 0);
            int measuredHeight = mContractedChild.getMeasuredHeight();
            int measuredHeight = mContractedChild.getMeasuredHeight();
            if (measuredHeight < mMinContractedHeight) {
            if (measuredHeight < mMinContractedHeight) {
                heightSpec = MeasureSpec.makeMeasureSpec(mMinContractedHeight, MeasureSpec.EXACTLY);
                heightSpec = MeasureSpec.makeMeasureSpec(mMinContractedHeight, MeasureSpec.EXACTLY);
                mContractedChild.measure(widthMeasureSpec, heightSpec);
                measureChildWithMargins(mContractedChild, widthMeasureSpec, 0, heightSpec, 0);
            }
            }
            maxChildHeight = Math.max(maxChildHeight, measuredHeight);
            maxChildHeight = Math.max(maxChildHeight, measuredHeight);
            if (updateContractedHeaderWidth()) {
            if (updateContractedHeaderWidth()) {
                mContractedChild.measure(widthMeasureSpec, heightSpec);
                measureChildWithMargins(mContractedChild, widthMeasureSpec, 0, heightSpec, 0);
            }
            }
            if (mExpandedChild != null
            if (mExpandedChild != null
                    && mContractedChild.getMeasuredHeight() > mExpandedChild.getMeasuredHeight()) {
                    && mContractedChild.getMeasuredHeight() > mExpandedChild.getMeasuredHeight()) {
                // the Expanded child is smaller then the collapsed. Let's remeasure it.
                // the Expanded child is smaller then the collapsed. Let's remeasure it.
                heightSpec = MeasureSpec.makeMeasureSpec(mContractedChild.getMeasuredHeight(),
                heightSpec = MeasureSpec.makeMeasureSpec(mContractedChild.getMeasuredHeight(),
                        MeasureSpec.EXACTLY);
                        MeasureSpec.EXACTLY);
                mExpandedChild.measure(widthMeasureSpec, heightSpec);
                measureChildWithMargins(mExpandedChild, widthMeasureSpec, 0, heightSpec, 0);
            }
            }
        }
        }
        if (mHeadsUpChild != null) {
        if (mHeadsUpChild != null) {
@@ -223,9 +230,9 @@ public class NotificationContentView extends FrameLayout {
                size = Math.min(size, layoutParams.height);
                size = Math.min(size, layoutParams.height);
                useExactly = true;
                useExactly = true;
            }
            }
            mHeadsUpChild.measure(widthMeasureSpec,
            measureChildWithMargins(mHeadsUpChild, widthMeasureSpec, 0,
                    MeasureSpec.makeMeasureSpec(size, useExactly ? MeasureSpec.EXACTLY
                    MeasureSpec.makeMeasureSpec(size, useExactly ? MeasureSpec.EXACTLY
                            : MeasureSpec.AT_MOST));
                            : MeasureSpec.AT_MOST), 0);
            maxChildHeight = Math.max(maxChildHeight, mHeadsUpChild.getMeasuredHeight());
            maxChildHeight = Math.max(maxChildHeight, mHeadsUpChild.getMeasuredHeight());
        }
        }
        if (mSingleLineView != null) {
        if (mSingleLineView != null) {
@@ -382,6 +389,38 @@ public class NotificationContentView extends FrameLayout {
        mContractedWrapper = NotificationViewWrapper.wrap(getContext(), child,
        mContractedWrapper = NotificationViewWrapper.wrap(getContext(), child,
                mContainingNotification);
                mContainingNotification);
        mContractedWrapper.setDark(mDark, false /* animate */, 0 /* delay */);
        mContractedWrapper.setDark(mDark, false /* animate */, 0 /* delay */);
        updateMargins(child);
    }

    private void updateMargins(View child) {
        if (child == null) {
            return;
        }
        NotificationViewWrapper wrapper = getWrapperForView(child);
        boolean isCustomView = wrapper instanceof NotificationCustomViewWrapper;
        boolean needsMargins = isCustomView &&
                child.getContext().getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.P;
        int padding = needsMargins ? mCustomViewSidePaddings : 0;
        MarginLayoutParams layoutParams = (MarginLayoutParams) child.getLayoutParams();
        layoutParams.setMarginStart(padding);
        layoutParams.setMarginEnd(padding);
        child.setLayoutParams(layoutParams);
    }

    private NotificationViewWrapper getWrapperForView(View child) {
        if (child == mContractedChild) {
            return mContractedWrapper;
        }
        if (child == mExpandedChild) {
            return mExpandedWrapper;
        }
        if (child == mHeadsUpChild) {
            return mHeadsUpWrapper;
        }
        if (child == mAmbientChild) {
            return mAmbientWrapper;
        }
        return null;
    }
    }


    public void setExpandedChild(View child) {
    public void setExpandedChild(View child) {
@@ -415,6 +454,7 @@ public class NotificationContentView extends FrameLayout {
        mExpandedChild = child;
        mExpandedChild = child;
        mExpandedWrapper = NotificationViewWrapper.wrap(getContext(), child,
        mExpandedWrapper = NotificationViewWrapper.wrap(getContext(), child,
                mContainingNotification);
                mContainingNotification);
        updateMargins(child);
    }
    }


    public void setHeadsUpChild(View child) {
    public void setHeadsUpChild(View child) {
@@ -448,6 +488,7 @@ public class NotificationContentView extends FrameLayout {
        mHeadsUpChild = child;
        mHeadsUpChild = child;
        mHeadsUpWrapper = NotificationViewWrapper.wrap(getContext(), child,
        mHeadsUpWrapper = NotificationViewWrapper.wrap(getContext(), child,
                mContainingNotification);
                mContainingNotification);
        updateMargins(child);
    }
    }


    public void setAmbientChild(View child) {
    public void setAmbientChild(View child) {