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

Commit 4e102f76 authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

[Notif redesign] Update expand button

Update the look of the expand button to match the redesign spec.

Note that:
- notification_2025_expand_button_pill_bg is a fork of
  expand_button_pill_bg
- notification_2025_expand_button is a fork of
  notification_expand_button
- ic_notification_2025_expand and ic_notification_2025_collapse
  correspond to keyboard_arrow_down_24px and keyboard_arrow_up_24px
  from the Google Symbols library, unchanged.

Bug: 378660052
Test: visual test, screenshot tests to come later
Flag: android.app.notifications_redesign_templates
Change-Id: I91f7e3beef9874b863f6d66b70622e88830c45ef
parent fe2229e6
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.internal.widget;

import static android.app.Flags.notificationsRedesignTemplates;

import android.annotation.ColorInt;
import android.annotation.Nullable;
import android.content.Context;
@@ -130,10 +132,18 @@ public class NotificationExpandButton extends FrameLayout {
        int drawableId;
        int contentDescriptionId;
        if (mExpanded) {
            if (notificationsRedesignTemplates()) {
                drawableId = R.drawable.ic_notification_2025_collapse;
            } else {
                drawableId = R.drawable.ic_collapse_notification;
            }
            contentDescriptionId = R.string.expand_button_content_description_expanded;
        } else {
            if (notificationsRedesignTemplates()) {
                drawableId = R.drawable.ic_notification_2025_expand;
            } else {
                drawableId = R.drawable.ic_expand_notification;
            }
            contentDescriptionId = R.string.expand_button_content_description_collapsed;
        }
        setContentDescription(mContext.getText(contentDescriptionId));
+25 −0
Original line number Diff line number Diff line
<!--
  ~ 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.
  -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="960"
    android:viewportHeight="960"
    android:tint="?attr/colorControlNormal">
  <path
      android:fillColor="@android:color/white"
      android:pathData="M480,432L296,616L240,560L480,320L720,560L664,616L480,432Z"/>
</vector>
+25 −0
Original line number Diff line number Diff line
<!--
  ~ 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.
  -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="960"
    android:viewportHeight="960"
    android:tint="?attr/colorControlNormal">
  <path
      android:fillColor="@android:color/white"
      android:pathData="M480,616L240,376L296,320L480,504L664,320L720,376L480,616Z"/>
</vector>
+29 −0
Original line number Diff line number Diff line
<!--
  ~ 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.
  -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/expand_button_pill_colorized_layer">
        <shape xmlns:android="http://schemas.android.com/apk/res/android">
            <corners android:radius="@dimen/notification_2025_expand_button_pill_height" />
            <solid android:color="@android:color/white" />
        </shape>
    </item>
    <item>
        <shape xmlns:android="http://schemas.android.com/apk/res/android">
            <corners android:radius="@dimen/notification_2025_expand_button_pill_height" />
            <solid android:color="@color/notification_expand_button_state_tint" />
        </shape>
    </item>
</layer-list>
+61 −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
  -->

<!-- extends FrameLayout -->
<com.android.internal.widget.NotificationExpandButton
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/expand_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="top|end"
    android:contentDescription="@string/expand_button_content_description_collapsed"
    >

    <LinearLayout
        android:id="@+id/expand_button_pill"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:minHeight="@dimen/notification_2025_expand_button_pill_height"
        android:minWidth="@dimen/notification_2025_expand_button_pill_width"
        android:paddingVertical="@dimen/notification_2025_expand_button_vertical_icon_padding"
        android:paddingHorizontal="@dimen/notification_2025_expand_button_horizontal_icon_padding"
        android:orientation="horizontal"
        android:background="@drawable/notification_2025_expand_button_pill_bg"
        android:gravity="center"
        android:layout_gravity="center_vertical"
        android:duplicateParentState="true"
        >

        <TextView
            android:id="@+id/expand_button_number"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="@style/TextAppearance.DeviceDefault.Notification.Info"
            android:gravity="center_vertical"
            android:visibility="gone"
            />

        <ImageView
            android:id="@+id/expand_button_icon"
            android:layout_width="@dimen/notification_2025_expand_button_icon_size"
            android:layout_height="@dimen/notification_2025_expand_button_icon_size"
            android:scaleType="fitCenter"
            android:importantForAccessibility="no"
            />

    </LinearLayout>

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