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

Commit 62c9bc2f authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

[Notif redesign] Bigger "small" icon in expanded notifs

Updated the remaining expanded templates to use the new header with the
larger icon. We still need to adjust the vertical alignment of the
header though.

There's a KI where the avatars in the old style messaging notification
overlap the app icon, but that will be fixed in a follow-up CL.

Note that:
- notification_2025_template_expanded_big_picture is a fork of
  notification_template_material_big_picture
- notification_2025_template_expanded_big_text is a fork of
  notification_template_material_big_text
- notification_2025_template_expanded_inbox is a fork of
  notification_template_material_inbox
- notification_2025_template_expanded_media is a fork of
  notification_template_material_big_media
- notification_2025_template_expanded_messaging is a fork of
  notification_template_material_big_messaging
- notification_2025_template_expanded_progress is a fork of
  notification_template_material_progress

Bug: 378660052
Test: visual test, screenshot tests to come later
Flag: android.app.notifications_redesign_templates
Change-Id: Iea8327e285d1cfab57fdadf737b544ba433ee726
parent e4664cee
Loading
Loading
Loading
Loading
+41 −13
Original line number Diff line number Diff line
@@ -821,14 +821,14 @@ public class Notification implements Parcelable
                     R.layout.notification_2025_template_collapsed_call,
                     R.layout.notification_2025_template_expanded_call,
                     R.layout.notification_2025_template_collapsed_messaging,
                     R.layout.notification_2025_template_expanded_messaging,
                     R.layout.notification_2025_template_collapsed_media,
                     R.layout.notification_template_material_big_picture,
                     R.layout.notification_template_material_big_text,
                     R.layout.notification_template_material_inbox,
                     R.layout.notification_template_material_big_messaging,
                     R.layout.notification_template_material_big_media,
                     R.layout.notification_template_header -> true;
                case R.layout.notification_template_material_progress -> Flags.apiRichOngoing();
                     R.layout.notification_2025_template_expanded_media,
                     R.layout.notification_2025_template_expanded_big_picture,
                     R.layout.notification_2025_template_expanded_big_text,
                     R.layout.notification_2025_template_expanded_inbox -> true;
                case R.layout.notification_2025_template_expanded_progress
                        -> Flags.apiRichOngoing();
                default -> false;
            };
        }
@@ -7561,16 +7561,28 @@ public class Notification implements Parcelable
        }
        private int getBigPictureLayoutResource() {
            if (Flags.notificationsRedesignTemplates()) {
                return R.layout.notification_2025_template_expanded_big_picture;
            } else {
                return R.layout.notification_template_material_big_picture;
            }
        }
        private int getBigTextLayoutResource() {
            if (Flags.notificationsRedesignTemplates()) {
                return R.layout.notification_2025_template_expanded_big_text;
            } else {
                return R.layout.notification_template_material_big_text;
            }
        }
        private int getInboxLayoutResource() {
            if (Flags.notificationsRedesignTemplates()) {
                return R.layout.notification_2025_template_expanded_inbox;
            } else {
                return R.layout.notification_template_material_inbox;
            }
        }
        private int getCollapsedMessagingLayoutResource() {
            if (Flags.notificationsRedesignTemplates()) {
@@ -7581,8 +7593,12 @@ public class Notification implements Parcelable
        }
        private int getExpandedMessagingLayoutResource() {
            if (Flags.notificationsRedesignTemplates()) {
                return R.layout.notification_2025_template_expanded_messaging;
            } else {
                return R.layout.notification_template_material_big_messaging;
            }
        }
        private int getCollapsedMediaLayoutResource() {
            if (Flags.notificationsRedesignTemplates()) {
@@ -7592,6 +7608,14 @@ public class Notification implements Parcelable
            }
        }
        private int getExpandedMediaLayoutResource() {
            if (Flags.notificationsRedesignTemplates()) {
                return R.layout.notification_2025_template_expanded_media;
            } else {
                return R.layout.notification_template_material_big_media;
            }
        }
        private int getConversationLayoutResource() {
            if (Flags.notificationsRedesignTemplates()) {
                return R.layout.notification_2025_template_conversation;
@@ -7617,8 +7641,12 @@ public class Notification implements Parcelable
        }
        private int getProgressLayoutResource() {
            if (Flags.notificationsRedesignTemplates()) {
                return R.layout.notification_2025_template_expanded_progress;
            } else {
                return R.layout.notification_template_material_progress;
            }
        }
        private int getActionLayoutResource() {
            return R.layout.notification_material_action;
@@ -10541,7 +10569,7 @@ public class Notification implements Parcelable
                    .fillTextsFrom(mBuilder);
            TemplateBindResult result = new TemplateBindResult();
            RemoteViews template = mBuilder.applyStandardTemplate(
                    R.layout.notification_template_material_big_media, p , result);
                    mBuilder.getExpandedMediaLayoutResource(), p , result);
            for (int i = 0; i < MAX_MEDIA_BUTTONS; i++) {
                if (i < actionCount) {
+93 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (C) 2024 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
  -->

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/status_bar_latest_event_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:tag="bigPicture"
    android:clipChildren="false"
    >

    <include layout="@layout/notification_2025_template_header" />

    <include layout="@layout/notification_template_right_icon" />

    <LinearLayout
        android:id="@+id/notification_action_list_margin_target"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="top"
        android:layout_marginTop="@dimen/notification_content_margin_top"
        android:clipToPadding="false"
        android:orientation="vertical"
        >

        <LinearLayout
            android:id="@+id/notification_main_column"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/notification_2025_content_margin_start"
            android:layout_marginEnd="@dimen/notification_content_margin_end"
            android:orientation="vertical"
            >

            <include layout="@layout/notification_template_part_line1" />

            <include
                layout="@layout/notification_template_progress"
                android:layout_width="match_parent"
                android:layout_height="@dimen/notification_progress_bar_height"
                android:layout_marginTop="@dimen/notification_progress_margin_top"
                />

            <include layout="@layout/notification_template_text_multiline" />
        </LinearLayout>

        <com.android.internal.widget.BigPictureNotificationImageView
            android:id="@+id/big_picture"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:adjustViewBounds="true"
            android:layout_weight="1"
            android:layout_marginTop="13dp"
            android:layout_marginStart="@dimen/notification_2025_content_margin_start"
            android:layout_marginEnd="@dimen/notification_content_margin_end"
            android:background="@drawable/notification_big_picture_outline"
            android:clipToOutline="true"
            android:scaleType="centerCrop"
            />

        <ViewStub
            android:layout="@layout/notification_material_reply_text"
            android:id="@+id/notification_2025_reply_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            />

        <include
            layout="@layout/notification_template_smart_reply_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/notification_2025_content_margin_start"
            android:layout_marginEnd="@dimen/notification_content_margin_end"
            android:layout_marginTop="@dimen/notification_content_margin"
            />

        <include layout="@layout/notification_material_action_list" />
    </LinearLayout>
</FrameLayout>
+94 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (C) 2024 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
  -->

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/status_bar_latest_event_content"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clipChildren="false"
    android:tag="bigText"
    >

    <include layout="@layout/notification_2025_template_header" />

    <com.android.internal.widget.RemeasuringLinearLayout
        android:id="@+id/notification_action_list_margin_target"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="top"
        android:layout_marginTop="@dimen/notification_content_margin_top"
        android:layout_marginBottom="@dimen/notification_content_margin"
        android:clipToPadding="false"
        android:orientation="vertical"
        >

        <com.android.internal.widget.RemeasuringLinearLayout
            android:id="@+id/notification_main_column"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="top"
            android:paddingStart="@dimen/notification_2025_content_margin_start"
            android:paddingEnd="@dimen/notification_content_margin_end"
            android:clipToPadding="false"
            android:orientation="vertical"
            android:layout_weight="1"
            >

            <include layout="@layout/notification_template_part_line1" />

            <include
                layout="@layout/notification_template_progress"
                android:layout_width="match_parent"
                android:layout_height="@dimen/notification_progress_bar_height"
                android:layout_marginTop="@dimen/notification_progress_margin_top"
                android:layout_marginBottom="6dp"
                />

            <com.android.internal.widget.ImageFloatingTextView
                android:id="@+id/big_text"
                style="@style/Widget.DeviceDefault.Notification.Text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/notification_text_margin_top"
                android:singleLine="false"
                android:gravity="top"
                android:visibility="gone"
                android:textAlignment="viewStart"
                />
        </com.android.internal.widget.RemeasuringLinearLayout>

        <ViewStub
            android:layout="@layout/notification_material_reply_text"
            android:id="@+id/notification_2025_reply_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            />

        <include
            layout="@layout/notification_template_smart_reply_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/notification_2025_content_margin_start"
            android:layout_marginEnd="@dimen/notification_content_margin_end"
            android:layout_marginTop="@dimen/notification_content_margin"
            />

        <include layout="@layout/notification_material_action_list" />
    </com.android.internal.widget.RemeasuringLinearLayout>

    <include layout="@layout/notification_template_right_icon" />
</FrameLayout>
+131 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2024 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
  -->

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/status_bar_latest_event_content"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:tag="inbox"
    android:clipChildren="false"
    >
    <include layout="@layout/notification_2025_template_header" />
    <LinearLayout
            android:id="@+id/notification_action_list_margin_target"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="top"
            android:layout_marginTop="@dimen/notification_content_margin_top"
            android:clipToPadding="false"
            android:orientation="vertical">

        <LinearLayout
            android:id="@+id/notification_main_column"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="top"
            android:paddingStart="@dimen/notification_2025_content_margin_start"
            android:paddingEnd="@dimen/notification_content_margin_end"
            android:layout_weight="1"
            android:clipToPadding="false"
            android:orientation="vertical"
            >
            <include layout="@layout/notification_template_part_line1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
            <include layout="@layout/notification_template_progress"
                android:layout_width="match_parent"
                android:layout_height="@dimen/notification_progress_bar_height"
                android:layout_marginTop="@dimen/notification_progress_margin_top"
                android:layout_marginBottom="2dp"/>
            <TextView android:id="@+id/inbox_text0"
                style="@style/Widget.DeviceDefault.Notification.Text"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:singleLine="true"
                android:ellipsize="end"
                android:visibility="gone"
                android:layout_weight="1"
                />
            <TextView android:id="@+id/inbox_text1"
                style="@style/Widget.DeviceDefault.Notification.Text"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:singleLine="true"
                android:ellipsize="end"
                android:visibility="gone"
                android:layout_weight="1"
                />
            <TextView android:id="@+id/inbox_text2"
                style="@style/Widget.DeviceDefault.Notification.Text"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:singleLine="true"
                android:ellipsize="end"
                android:visibility="gone"
                android:layout_weight="1"
                />
            <TextView android:id="@+id/inbox_text3"
                style="@style/Widget.DeviceDefault.Notification.Text"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:singleLine="true"
                android:ellipsize="end"
                android:visibility="gone"
                android:layout_weight="1"
                />
            <TextView android:id="@+id/inbox_text4"
                style="@style/Widget.DeviceDefault.Notification.Text"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:singleLine="true"
                android:ellipsize="end"
                android:visibility="gone"
                android:layout_weight="1"
                />
            <TextView android:id="@+id/inbox_text5"
                style="@style/Widget.DeviceDefault.Notification.Text"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:singleLine="true"
                android:ellipsize="end"
                android:visibility="gone"
                android:layout_weight="1"
                />
            <TextView android:id="@+id/inbox_text6"
                style="@style/Widget.DeviceDefault.Notification.Text"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:singleLine="true"
                android:ellipsize="end"
                android:visibility="gone"
                android:layout_weight="1"
                />
        </LinearLayout>
        <ViewStub android:layout="@layout/notification_material_reply_text"
                android:id="@+id/notification_2025_reply_container"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
        <include layout="@layout/notification_template_smart_reply_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/notification_2025_content_margin_start"
            android:layout_marginEnd="@dimen/notification_content_margin_end"
            android:layout_marginTop="@dimen/notification_content_margin" />
        <include layout="@layout/notification_material_action_list" />
    </LinearLayout>
    <include layout="@layout/notification_template_right_icon" />
</FrameLayout>
+107 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (C) 2024 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
  -->

<!-- Note: This is the expanded version of the old media style notification (different from UMO). -->

<!-- extends FrameLayout -->
<com.android.internal.widget.MediaNotificationView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/status_bar_latest_event_content"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:tag="bigMediaNarrow"
    >

    <include layout="@layout/notification_2025_template_header" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:id="@+id/notification_media_content"
        >

        <LinearLayout
            android:id="@+id/notification_main_column"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/notification_content_margin_top"
            android:layout_marginStart="@dimen/notification_2025_content_margin_start"
            android:layout_marginEnd="@dimen/notification_content_margin_end"
            android:orientation="vertical"
            >
            <include layout="@layout/notification_template_part_line1"/>
            <include layout="@layout/notification_template_text"/>
        </LinearLayout>

        <!-- this FrameLayout's minHeight serves as a padding for the content above -->
        <FrameLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="38dp"
            android:minHeight="@dimen/notification_content_margin"
            >
            <!-- The layout_marginStart is selected to ensure that action icons which are visually
                 12x12 in a 24x24 drawable will align correctly with the text.  This means that
                 stock media action icons will align, but icons may be visually up to 20x20 and
                 remain in-spec, in which case they will protrude into the column slightly. -->

            <!-- Nesting in FrameLayout is required to ensure that the marginStart actually applies
                 at the start instead of always the left, given that the media_actions LinearLayout
                 has layoutDirection="ltr". -->
            <LinearLayout
                android:id="@+id/media_actions"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/media_notification_actions_padding_bottom"
                android:gravity="top"
                android:orientation="horizontal"
                android:layoutDirection="ltr"
                >

                <include
                    layout="@layout/notification_material_media_action"
                    android:id="@+id/action0"
                    />

                <include
                    layout="@layout/notification_material_media_action"
                    android:id="@+id/action1"
                    />

                <include
                    layout="@layout/notification_material_media_action"
                    android:id="@+id/action2"
                    />

                <include
                    layout="@layout/notification_material_media_action"
                    android:id="@+id/action3"
                    />

                <include
                    layout="@layout/notification_material_media_action"
                    android:id="@+id/action4"
                    />
            </LinearLayout>

        </FrameLayout>

    </LinearLayout>

    <include layout="@layout/notification_template_right_icon" />

</com.android.internal.widget.MediaNotificationView>
Loading