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

Commit 221bffcf authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

Adjust right icon spacing based on font size

Split notification_2025_right_icon_margin_end into a dp-based dimension
and a sp-based one so that the spacing is still correct if the font size
changes (since the font affects the width of the expander).

Fix: 420643875
Bug: 403536710
Test: manually test notifications with and without a large icon, in all
the font and display sizes
Flag: android.app.notifications_redesign_templates

Change-Id: I70a54a6555e0f92824a3f4eb12001c755f0d710f
parent 9c18d720
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -6319,14 +6319,14 @@ public class Notification implements Parcelable
                // No expander is shown in promoted notifications
                spaceForExpanderDp = 0;
            } else {
                final int expanderSizeRes;
                if (notificationsRedesignTemplates()) {
                    expanderSizeRes = R.dimen.notification_2025_right_icon_expanded_margin_end;
                    spaceForExpanderDp = getLargeIconMarginEnd(mParams) / density
                            - notificationMarginDp;
                } else {
                    expanderSizeRes =  R.dimen.notification_header_expand_icon_size;
                }
                    spaceForExpanderDp = resources.getDimension(
                        expanderSizeRes) / density - contentMarginDp;
                            R.dimen.notification_header_expand_icon_size) / density
                            - contentMarginDp;
                }
            }
            final float viewHeightDp = resources.getDimension(
@@ -6420,8 +6420,11 @@ public class Notification implements Parcelable
            }
            if (notificationsRedesignTemplates()) {
                return res.getDimensionPixelSize(
                int rightIconMarginPx = res.getDimensionPixelSize(
                        R.dimen.notification_2025_right_icon_expanded_margin_end);
                int extraSpaceForExpanderPx = res.getDimensionPixelSize(
                        R.dimen.notification_2025_extra_space_for_expander);
                return rightIconMarginPx + extraSpaceForExpanderPx;
            } else {
                return res.getDimensionPixelSize(R.dimen.notification_header_expand_icon_size);
            }
+6 −4
Original line number Diff line number Diff line
@@ -408,10 +408,12 @@
    <dimen name="notification_header_expand_icon_size">56dp</dimen>

    <!-- Margin to allow space for the expand button when showing the right icon in expanded -->
    <!-- notifications. This is equal to notification_2025_expand_button_pill_width -->
    <!-- + notification_2025_margin (end padding for expand button) -->
    <!-- + notification_2025_expand_button_right_icon_spacing (space between pill and icon) -->
    <dimen name="notification_2025_right_icon_expanded_margin_end">52dp</dimen>
    <!-- notifications. The notification_2025_extra_space_for_expander should be used in -->
    <!-- addition to this to ensure the spacing adjusts with the font size accordingly -->
    <dimen name="notification_2025_right_icon_expanded_margin_end">42dp</dimen>

    <!-- sp-based additional spacing for the expand button, to scale with the font size -->
    <dimen name="notification_2025_extra_space_for_expander">10sp</dimen>

    <!-- The large icon has a smaller vertical margin than most other notification content, to -->
    <!-- allow it to grow up to 48dp. -->
+1 −0
Original line number Diff line number Diff line
@@ -3297,6 +3297,7 @@
  <java-symbol type="dimen" name="notification_2025_expand_button_reduced_end_padding" />
  <java-symbol type="dimen" name="notification_2025_expand_button_right_icon_spacing" />
  <java-symbol type="dimen" name="notification_2025_right_icon_expanded_margin_end" />
  <java-symbol type="dimen" name="notification_2025_extra_space_for_expander" />
  <java-symbol type="dimen" name="notification_2025_action_list_margin_bottom" />
  <java-symbol type="dimen" name="notification_2025_smart_reply_container_margin" />
  <java-symbol type="dimen" name="notification_progress_margin_horizontal" />