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

Commit 98a6e637 authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

[Notif redesign] Update notification info design

Updating the layout of notification guts to match the redesign specs.

Note that notification_2025_info.xml is a fork of notification_info.xml,
and notification_2025_guts_priority_button_bg.xml  is a fork of
notification_guts_priority_button_bg.xml.

There's a lot of duplication in this layout that is less than ideal, but
I left it alone since we plan to rewrite this in compose very soon
anyway. I will also remove the "Automatic" button in a follow-up because
we're not actually using it.

Bug: 394822197
Test: tested manually
Flag: com.android.systemui.notifications_redesign_guts
Change-Id: Ibb7c54c6cbede0ef5426315cd9f9753ee55e1806
parent 6d57d74a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -268,6 +268,9 @@
     72dp (content margin) - 12dp (action padding) - 4dp (button inset) -->
    <dimen name="notification_2025_actions_margin_start">56dp</dimen>

    <!-- Notification action button text size -->
    <dimen name="notification_2025_action_text_size">16sp</dimen>

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

+27 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2025 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License
  -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle" >
    <solid
        android:color="@color/notification_guts_priority_button_bg_fill" />

    <stroke
        android:width="1.5dp"
        android:color="@color/notification_guts_priority_button_bg_stroke" />

    <corners android:radius="16dp" />
</shape>
+365 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright 2025, The Android Open Source Project

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->

<!-- extends LinearLayout -->
<com.android.systemui.statusbar.notification.row.NotificationInfo
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:id="@+id/notification_guts"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:focusable="true"
    android:clipChildren="false"
    android:clipToPadding="true"
    android:orientation="vertical"
    android:paddingStart="@*android:dimen/notification_2025_margin">

    <!-- Package Info -->
    <LinearLayout
        android:id="@+id/header"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clipChildren="false"
        android:clipToPadding="true">
        <ImageView
            android:id="@+id/pkg_icon"
            android:layout_width="@*android:dimen/notification_2025_icon_circle_size"
            android:layout_height="@*android:dimen/notification_2025_icon_circle_size"
            android:layout_marginTop="@*android:dimen/notification_2025_margin"
            android:layout_marginEnd="@*android:dimen/notification_2025_margin" />
        <LinearLayout
            android:id="@+id/names"
            android:layout_weight="1"
            android:layout_width="0dp"
            android:orientation="vertical"
            android:layout_height="wrap_content"
            android:layout_marginTop="@*android:dimen/notification_2025_margin"
            android:minHeight="@*android:dimen/notification_2025_icon_circle_size">
            <TextView
                android:id="@+id/channel_name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textDirection="locale"
                style="@style/TextAppearance.NotificationImportanceChannel"/>
            <TextView
                android:id="@+id/group_name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textDirection="locale"
                android:ellipsize="end"
                style="@style/TextAppearance.NotificationImportanceChannelGroup"/>
            <TextView
                android:id="@+id/pkg_name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                style="@style/TextAppearance.NotificationImportanceApp"
                android:ellipsize="end"
                android:textDirection="locale"
                android:maxLines="1"/>
            <TextView
                android:id="@+id/delegate_name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                style="@style/TextAppearance.NotificationImportanceHeader"
                android:ellipsize="end"
                android:textDirection="locale"
                android:text="@string/notification_delegate_header"
                android:maxLines="1" />

        </LinearLayout>

        <!-- feedback for notificationassistantservice -->
        <ImageButton
            android:id="@+id/feedback"
            android:layout_width="@dimen/notification_2025_guts_button_size"
            android:layout_height="@dimen/notification_2025_guts_button_size"
            android:visibility="gone"
            android:background="@drawable/ripple_drawable"
            android:contentDescription="@string/notification_guts_bundle_feedback"
            android:src="@*android:drawable/ic_feedback"
            android:paddingTop="@*android:dimen/notification_2025_margin"
            android:tint="@androidprv:color/materialColorPrimary"/>

        <!-- Optional link to app. Only appears if the channel is not disabled and the app
        asked for it -->
        <ImageButton
            android:id="@+id/app_settings"
            android:layout_width="@dimen/notification_2025_guts_button_size"
            android:layout_height="@dimen/notification_2025_guts_button_size"
            android:visibility="gone"
            android:background="@drawable/ripple_drawable"
            android:contentDescription="@string/notification_app_settings"
            android:src="@drawable/ic_info"
            android:paddingTop="@*android:dimen/notification_2025_margin"
            android:tint="@androidprv:color/materialColorPrimary"/>

        <!-- System notification settings -->
        <ImageButton
            android:id="@+id/info"
            android:layout_width="@dimen/notification_2025_guts_button_size"
            android:layout_height="@dimen/notification_2025_guts_button_size"
            android:contentDescription="@string/notification_more_settings"
            android:background="@drawable/ripple_drawable"
            android:src="@drawable/ic_settings"
            android:padding="@*android:dimen/notification_2025_margin"
            android:tint="@androidprv:color/materialColorPrimary" />

    </LinearLayout>

    <LinearLayout
        android:id="@+id/inline_controls"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginEnd="@*android:dimen/notification_2025_margin"
        android:layout_marginTop="@*android:dimen/notification_2025_margin"
        android:clipChildren="false"
        android:clipToPadding="false"
        android:orientation="vertical">

        <!-- Non configurable app/channel text. appears instead of @+id/interruptiveness_settings-->
        <TextView
            android:id="@+id/non_configurable_text"
            android:text="@string/notification_unblockable_desc"
            android:visibility="gone"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            style="@*android:style/TextAppearance.DeviceDefault.Notification" />

        <!-- Non configurable app/channel text. appears instead of @+id/interruptiveness_settings-->
        <TextView
            android:id="@+id/non_configurable_call_text"
            android:text="@string/notification_unblockable_call_desc"
            android:visibility="gone"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            style="@*android:style/TextAppearance.DeviceDefault.Notification" />

        <!-- Non configurable multichannel text. appears instead of @+id/interruptiveness_settings-->
        <TextView
            android:id="@+id/non_configurable_multichannel_text"
            android:text="@string/notification_multichannel_desc"
            android:visibility="gone"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            style="@*android:style/TextAppearance.DeviceDefault.Notification" />

        <LinearLayout
            android:id="@+id/interruptiveness_settings"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:orientation="vertical">
            <com.android.systemui.statusbar.notification.row.ButtonLinearLayout
                android:id="@+id/automatic"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingVertical="@dimen/notification_2025_importance_button_padding_vertical"
                android:paddingHorizontal="@dimen/notification_2025_importance_button_padding_horizontal"
                android:gravity="center_vertical"
                android:clickable="true"
                android:focusable="true"
                android:background="@drawable/notification_2025_guts_priority_button_bg"
                android:orientation="horizontal"
                android:visibility="gone">
                <ImageView
                    android:id="@+id/automatic_icon"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:paddingEnd="@*android:dimen/notification_2025_margin"
                    android:src="@drawable/ic_notifications_automatic"
                    android:background="@android:color/transparent"
                    android:tint="@color/notification_guts_priority_contents"
                    android:clickable="false"
                    android:focusable="false"/>
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:gravity="center"
                >
                    <TextView
                        android:id="@+id/automatic_label"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:ellipsize="end"
                        android:maxLines="1"
                        android:clickable="false"
                        android:focusable="false"
                        android:textAppearance="@style/TextAppearance.NotificationImportanceButton"
                        android:text="@string/notification_automatic_title"/>
                    <TextView
                        android:id="@+id/automatic_summary"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/notification_importance_button_description_top_margin"
                        android:visibility="gone"
                        android:text="@string/notification_channel_summary_automatic"
                        android:clickable="false"
                        android:focusable="false"
                        android:ellipsize="end"
                        android:maxLines="2"
                        android:textAppearance="@style/TextAppearance.NotificationImportanceDetail"/>
                </LinearLayout>
            </com.android.systemui.statusbar.notification.row.ButtonLinearLayout>

            <com.android.systemui.statusbar.notification.row.ButtonLinearLayout
                android:id="@+id/alert"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingVertical="@dimen/notification_2025_importance_button_padding_vertical"
                android:paddingHorizontal="@dimen/notification_2025_importance_button_padding_horizontal"
                android:gravity="center_vertical"
                android:clickable="true"
                android:focusable="true"
                android:background="@drawable/notification_2025_guts_priority_button_bg"
                android:orientation="horizontal">
                <ImageView
                    android:id="@+id/alert_icon"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:paddingEnd="@*android:dimen/notification_2025_margin"
                    android:src="@drawable/ic_notifications_alert"
                    android:background="@android:color/transparent"
                    android:tint="@color/notification_guts_priority_contents"
                    android:clickable="false"
                    android:focusable="false"/>
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:gravity="center"
                    >
                    <TextView
                        android:id="@+id/alert_label"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:ellipsize="end"
                        android:maxLines="1"
                        android:clickable="false"
                        android:focusable="false"
                        android:textAppearance="@style/TextAppearance.NotificationImportanceButton"
                        android:text="@string/notification_alert_title"/>
                    <TextView
                        android:id="@+id/alert_summary"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:visibility="gone"
                        android:text="@string/notification_channel_summary_default"
                        android:clickable="false"
                        android:focusable="false"
                        android:ellipsize="end"
                        android:maxLines="2"
                        android:textAppearance="@style/TextAppearance.NotificationImportanceDetail"/>
                </LinearLayout>
            </com.android.systemui.statusbar.notification.row.ButtonLinearLayout>

            <com.android.systemui.statusbar.notification.row.ButtonLinearLayout
                android:id="@+id/silence"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/notification_importance_button_separation"
                android:paddingVertical="@dimen/notification_2025_importance_button_padding_vertical"
                android:paddingHorizontal="@dimen/notification_2025_importance_button_padding_horizontal"
                android:gravity="center_vertical"
                android:clickable="true"
                android:focusable="true"
                android:background="@drawable/notification_2025_guts_priority_button_bg"
                android:orientation="horizontal">
                <ImageView
                    android:id="@+id/silence_icon"
                    android:src="@drawable/ic_notifications_silence"
                    android:background="@android:color/transparent"
                    android:tint="@color/notification_guts_priority_contents"
                    android:layout_gravity="center"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:paddingEnd="@*android:dimen/notification_2025_margin"
                    android:clickable="false"
                    android:focusable="false"/>
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:gravity="center"
                    >
                    <TextView
                        android:id="@+id/silence_label"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:ellipsize="end"
                        android:maxLines="1"
                        android:clickable="false"
                        android:focusable="false"
                        android:layout_toEndOf="@id/silence_icon"
                        android:textAppearance="@style/TextAppearance.NotificationImportanceButton"
                        android:text="@string/notification_silence_title"/>
                    <TextView
                        android:id="@+id/silence_summary"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:visibility="gone"
                        android:text="@string/notification_channel_summary_low"
                        android:clickable="false"
                        android:focusable="false"
                        android:ellipsize="end"
                        android:maxLines="2"
                        android:textAppearance="@style/TextAppearance.NotificationImportanceDetail"/>
                </LinearLayout>
            </com.android.systemui.statusbar.notification.row.ButtonLinearLayout>

        </LinearLayout>

        <LinearLayout
            android:id="@+id/bottom_buttons"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@*android:dimen/notification_2025_margin"
            android:minHeight="@dimen/notification_2025_guts_button_size"
            android:gravity="center_vertical"
            >
            <TextView
                android:id="@+id/turn_off_notifications"
                android:text="@string/inline_turn_off_notifications"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginEnd="32dp"
                android:paddingTop="8dp"
                android:paddingBottom="@*android:dimen/notification_2025_margin"
                android:gravity="center"
                android:minWidth="@dimen/notification_2025_min_tap_target_size"
                android:minHeight="@dimen/notification_2025_min_tap_target_size"
                android:maxWidth="200dp"
                style="@style/TextAppearance.NotificationInfo.Button"
                android:textSize="@*android:dimen/notification_2025_action_text_size"/>
            <TextView
                android:id="@+id/done"
                android:text="@string/inline_ok_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingTop="8dp"
                android:paddingBottom="@*android:dimen/notification_2025_margin"
                android:gravity="center"
                android:minWidth="@dimen/notification_2025_min_tap_target_size"
                android:minHeight="@dimen/notification_2025_min_tap_target_size"
                android:maxWidth="125dp"
                style="@style/TextAppearance.NotificationInfo.Button"
                android:textSize="@*android:dimen/notification_2025_action_text_size"/>
        </LinearLayout>
    </LinearLayout>
</com.android.systemui.statusbar.notification.row.NotificationInfo>
+10 −0
Original line number Diff line number Diff line
@@ -390,6 +390,12 @@
    <!-- Extra space for guts bundle feedback button -->
    <dimen name="notification_guts_bundle_feedback_size">48dp</dimen>

    <!-- Size of icon buttons in notification info. -->
    <!-- 24dp for the icon itself + 16dp * 2 for top and bottom padding -->
    <dimen name="notification_2025_guts_button_size">56dp</dimen>

    <dimen name="notification_2025_min_tap_target_size">48dp</dimen>

    <dimen name="notification_importance_toggle_size">48dp</dimen>
    <dimen name="notification_importance_button_separation">8dp</dimen>
    <dimen name="notification_importance_drawable_padding">8dp</dimen>
@@ -402,6 +408,10 @@
    <dimen name="notification_importance_button_description_top_margin">12dp</dimen>
    <dimen name="rect_button_radius">8dp</dimen>

    <!-- Padding for importance selection buttons in notification info, 2025 redesign version -->
    <dimen name="notification_2025_importance_button_padding_vertical">12dp</dimen>
    <dimen name="notification_2025_importance_button_padding_horizontal">16dp</dimen>

    <!-- The minimum height for the snackbar shown after the snooze option has been chosen. -->
    <dimen name="snooze_snackbar_min_height">56dp</dimen>

+5 −2
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

package com.android.systemui.statusbar.notification.row;

import static android.app.NotificationChannel.SYSTEM_RESERVED_IDS;
import static android.app.Flags.notificationsRedesignTemplates;
import static android.view.HapticFeedbackConstants.CLOCK_TICK;

import static com.android.systemui.SwipeHelper.SWIPED_FAR_ENOUGH_SIZE_FRACTION;
@@ -706,8 +706,11 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
    static NotificationMenuItem createInfoItem(Context context) {
        Resources res = context.getResources();
        String infoDescription = res.getString(R.string.notification_menu_gear_description);
        int layoutId = notificationsRedesignTemplates()
                ? R.layout.notification_2025_info
                : R.layout.notification_info;
        NotificationInfo infoContent = (NotificationInfo) LayoutInflater.from(context).inflate(
                R.layout.notification_info, null, false);
                layoutId, null, false);
        return new NotificationMenuItem(context, infoDescription, infoContent,
                R.drawable.ic_settings);
    }