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

Commit d13755c9 authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

[Notif redesign] Align actions to larger icon

Updating the margin of notification actions to fit the new content
margin for the larger "small" icon. We no longer need a separate value
for the conversation margin.

Note that I opted to call this new dimension "margin" instead of
"padding" because although it's called a padding in
NotificationActionListLayout, it's not actually used as a padding.

Bug: 378660052
Test: visual test, screenshot tests to come later
Flag: android.app.notifications_redesign_templates
Change-Id: I6ee981e0677dbfb98bbe15cc68ed9691d4a41f2f
parent 877c9060
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -6445,10 +6445,13 @@ public class Notification implements Parcelable
                // Clear view padding to allow buttons to start on the left edge.
                // This must be done before 'setEmphasizedMode' which sets top/bottom margins.
                big.setViewPadding(R.id.actions, 0, 0, 0, 0);
                // Add an optional indent that will make buttons start at the correct column when
                // there is enough space to do so (and fall back to the left edge if not).
                if (!Flags.notificationsRedesignTemplates()) {
                    // Add an optional indent that will make buttons start at the correct column
                    // when there is enough space to do so (and fall back to the left edge if not).
                    // This is handled directly in NotificationActionListLayout in the new design.
                    big.setInt(R.id.actions, "setCollapsibleIndentDimen",
                            R.dimen.call_notification_collapsible_indent);
                }
                if (evenlyDividedCallStyleActionLayout()) {
                    if (CallStyle.DEBUG_NEW_ACTION_LAYOUT) {
                        Log.d(TAG, "setting evenly divided mode on action list");
+2 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.internal.widget;

import static android.app.Flags.notificationsRedesignTemplates;
import static android.widget.flags.Flags.conversationLayoutUseMaximumChildHeight;

import static com.android.internal.widget.MessagingGroup.IMAGE_DISPLAY_LOCATION_EXTERNAL;
@@ -692,7 +693,7 @@ public class ConversationLayout extends FrameLayout
    }

    private void updateActionListPadding() {
        if (mActions != null) {
        if (!notificationsRedesignTemplates() && mActions != null) {
            mActions.setCollapsibleIndentDimen(R.dimen.call_notification_collapsible_indent);
        }
    }
+6 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.app.Notification.CallStyle.DEBUG_NEW_ACTION_LAYOUT;
import static android.app.Flags.evenlyDividedCallStyleActionLayout;

import android.annotation.DimenRes;
import android.app.Flags;
import android.app.Notification;
import android.content.Context;
import android.content.res.TypedArray;
@@ -58,7 +59,7 @@ public class NotificationActionListLayout extends LinearLayout {
    private int mEmphasizedPaddingBottom;
    private int mEmphasizedHeight;
    private int mRegularHeight;
    @DimenRes private int mCollapsibleIndentDimen = R.dimen.notification_actions_padding_start;
    @DimenRes private int mCollapsibleIndentDimen;
    int mNumNotGoneChildren;
    int mNumPriorityChildren;

@@ -73,6 +74,10 @@ public class NotificationActionListLayout extends LinearLayout {
    public NotificationActionListLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);

        mCollapsibleIndentDimen = Flags.notificationsRedesignTemplates()
                ? R.dimen.notification_2025_actions_margin_start
                : R.dimen.notification_actions_padding_start;

        int[] attrIds = { android.R.attr.gravity };
        TypedArray ta = context.obtainStyledAttributes(attrs, attrIds, defStyleAttr, defStyleRes);
        mGravity = ta.getInt(0, 0);
+6 −0
Original line number Diff line number Diff line
@@ -262,6 +262,12 @@
     72dp (content margin) - 8dp (media action padding) - 6dp (visual padding within drawable) -->
    <dimen name="notification_2025_media_actions_margin_start">58dp</dimen>

    <!-- The margin on the start of notification actions (2025 redesign version), to align them to
     the rest of the notification content. Note that this can be set to 0 if the actions would not
     fit with it included.
     72dp (content margin) - 12dp (action padding) - 4dp (button inset) -->
    <dimen name="notification_2025_actions_margin_start">56dp</dimen>

    <!-- The margin on the end of most content views (ignores the expander) -->
    <dimen name="notification_content_margin_end">16dp</dimen>

+1 −0
Original line number Diff line number Diff line
@@ -3480,6 +3480,7 @@

  <java-symbol type="bool" name="config_supportPreRebootSecurityLogs" />

  <java-symbol type="dimen" name="notification_2025_actions_margin_start"/>
  <java-symbol type="id" name="notification_action_list_margin_target" />
  <java-symbol type="dimen" name="notification_actions_padding_start"/>
  <java-symbol type="dimen" name="notification_actions_collapsed_priority_width"/>