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

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

[Notif redesign] Update smart replies/actions

This updates the corner radius and size of smart replies and smart actions to make them pills instead of rounded rectangles.

Note that notification_2025_smart_reply_button.xml and notification_2025_smart_reply_button_background.xml are forks of smart_reply_button.xml and smart_reply_button_background.xml respectively.

Bug: 378660052
Test: manual + screenshot tests
Flag: android.app.notifications_redesign_templates
Change-Id: I78b30ce80ad6738a596232430b217286eb9d1cdc
parent 8d0104f7
Loading
Loading
Loading
Loading
+35 −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
  -->

<ripple xmlns:android="http://schemas.android.com/apk/res/android"
        android:color="@color/notification_ripple_untinted_color">
    <item>
        <inset
            android:insetLeft="0dp"
            android:insetTop="8dp"
            android:insetRight="0dp"
            android:insetBottom="8dp">
            <shape android:shape="rectangle">
              <corners android:radius="@dimen/notification_2025_smart_reply_button_corner_radius" />
                <stroke android:width="@dimen/smart_reply_button_stroke_width"
                        android:color="@color/smart_reply_button_stroke" />
                <solid android:color="@color/smart_reply_button_background"/>
            </shape>
        </inset>
    </item>
</ripple>
+35 −0
Original line number Diff line number Diff line
<!--
  ~ 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
  -->

<!-- android:paddingHorizontal is set dynamically in SmartReplyView. -->
<Button xmlns:android="http://schemas.android.com/apk/res/android"
        style="@android:style/Widget.Material.Button"
        android:stateListAnimator="@null"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:minWidth="0dp"
        android:minHeight="@dimen/notification_2025_smart_reply_button_min_height"
        android:paddingVertical="@dimen/smart_reply_button_padding_vertical"
        android:background="@drawable/notification_2025_smart_reply_button_background"
        android:gravity="center"
        android:fontFamily="google-sans-flex"
        android:textSize="@dimen/smart_reply_button_font_size"
        android:textColor="@color/smart_reply_button_text"
        android:paddingStart="@dimen/smart_reply_button_action_padding_left"
        android:paddingEnd="@dimen/smart_reply_button_padding_horizontal"
        android:drawablePadding="@dimen/smart_action_button_icon_padding"
        android:textStyle="normal"
        android:ellipsize="none"/>
+36 −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
  -->

<!-- android:paddingHorizontal is set dynamically in SmartReplyView. -->
<Button xmlns:android="http://schemas.android.com/apk/res/android"
        style="@android:style/Widget.Material.Button"
        android:stateListAnimator="@null"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:minWidth="0dp"
        android:minHeight="@dimen/notification_2025_smart_reply_button_min_height"
        android:paddingVertical="@dimen/smart_reply_button_padding_vertical"
        android:background="@drawable/notification_2025_smart_reply_button_background"
        android:gravity="center"
        android:fontFamily="google-sans-flex"
        android:textSize="@dimen/smart_reply_button_font_size"
        android:textColor="@color/smart_reply_button_text"
        android:paddingStart="@dimen/smart_reply_button_padding_horizontal"
        android:paddingEnd="@dimen/smart_reply_button_padding_horizontal"
        android:textStyle="normal"
        android:ellipsize="none"/>
+2 −0
Original line number Diff line number Diff line
@@ -1157,6 +1157,8 @@
    <dimen name="smart_action_button_icon_size">18dp</dimen>
    <dimen name="smart_action_button_icon_padding">8dp</dimen>
    <dimen name="smart_action_button_outline_stroke_width">2dp</dimen>
    <dimen name="notification_2025_smart_reply_button_corner_radius">18dp</dimen>
    <dimen name="notification_2025_smart_reply_button_min_height">48dp</dimen>

    <!-- Magic Action params. -->
    <!-- Corner radius = half of min_height to create rounded sides. -->
+20 −13
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.policy

import android.app.ActivityOptions
import android.app.Flags.notificationsRedesignTemplates
import android.app.Notification
import android.app.Notification.Action.SEMANTIC_ACTION_MARK_CONVERSATION_AS_PRIORITY
import android.app.PendingIntent
@@ -53,7 +54,6 @@ import com.android.systemui.statusbar.SmartReplyController
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.headsup.HeadsUpManager
import com.android.systemui.statusbar.notification.logging.NotificationLogger
import com.android.systemui.statusbar.notification.row.MagicActionBackgroundDrawable
import com.android.systemui.statusbar.phone.KeyguardDismissUtil
import com.android.systemui.statusbar.policy.InflatedSmartReplyState.SuppressedActions
import com.android.systemui.statusbar.policy.SmartReplyView.SmartActions
@@ -397,16 +397,21 @@ constructor(
        delayOnClickListener: Boolean,
        packageContext: Context,
    ): Button {
        val isMagicAction = Flags.notificationMagicActionsTreatment() &&
        val isMagicAction =
            Flags.notificationMagicActionsTreatment() &&
                smartActions.fromAssistant &&
                action.extras.getBoolean(Notification.Action.EXTRA_IS_MAGIC, false)
        val layoutRes = if (isMagicAction) {
        val layoutRes =
            if (isMagicAction) {
                R.layout.magic_action_button
            } else {
                if (notificationsRedesignTemplates()) {
                    R.layout.notification_2025_smart_action_button
                } else {
                    R.layout.smart_action_button
                }
        return (LayoutInflater.from(parent.context).inflate(layoutRes, parent, false)
                as Button)
            }
        return (LayoutInflater.from(parent.context).inflate(layoutRes, parent, false) as Button)
            .apply {
                text = action.title

@@ -435,7 +440,6 @@ constructor(
                // Mark this as an Action button
                (layoutParams as SmartReplyView.LayoutParams).mButtonType = SmartButtonType.ACTION
            }

    }

    private fun onSmartActionClick(
@@ -499,9 +503,11 @@ constructor(
        replyIndex: Int,
        choice: CharSequence,
        delayOnClickListener: Boolean,
    ): Button =
        (LayoutInflater.from(parent.context).inflate(R.layout.smart_reply_button, parent, false)
                as Button)
    ): Button {
        val layoutRes =
            if (notificationsRedesignTemplates()) R.layout.notification_2025_smart_reply_button
            else R.layout.smart_reply_button
        return (LayoutInflater.from(parent.context).inflate(layoutRes, parent, false) as Button)
            .apply {
                text = choice
                val onClickListener =
@@ -531,6 +537,7 @@ constructor(
                // Mark this as a Reply button
                (layoutParams as SmartReplyView.LayoutParams).mButtonType = SmartButtonType.REPLY
            }
    }

    private fun onSmartReplyClick(
        entry: NotificationEntry,