diff options
5 files changed, 128 insertions, 13 deletions
diff --git a/packages/SystemUI/res/drawable/notification_2025_smart_reply_button_background.xml b/packages/SystemUI/res/drawable/notification_2025_smart_reply_button_background.xml new file mode 100644 index 000000000000..d398f60ddc3c --- /dev/null +++ b/packages/SystemUI/res/drawable/notification_2025_smart_reply_button_background.xml @@ -0,0 +1,35 @@ +<?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> diff --git a/packages/SystemUI/res/layout/notification_2025_smart_action_button.xml b/packages/SystemUI/res/layout/notification_2025_smart_action_button.xml new file mode 100644 index 000000000000..ed905885a76f --- /dev/null +++ b/packages/SystemUI/res/layout/notification_2025_smart_action_button.xml @@ -0,0 +1,35 @@ +<!-- + ~ 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"/> diff --git a/packages/SystemUI/res/layout/notification_2025_smart_reply_button.xml b/packages/SystemUI/res/layout/notification_2025_smart_reply_button.xml new file mode 100644 index 000000000000..4f543e5099bf --- /dev/null +++ b/packages/SystemUI/res/layout/notification_2025_smart_reply_button.xml @@ -0,0 +1,36 @@ +<?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"/> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index d547bd0d05f3..d0ae307b6919 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -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. --> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyStateInflater.kt b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyStateInflater.kt index d3af1e5b65fe..6d959be1c5f4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyStateInflater.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyStateInflater.kt @@ -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) { - R.layout.magic_action_button - } else { - R.layout.smart_action_button - } - return (LayoutInflater.from(parent.context).inflate(layoutRes, parent, false) - as Button) + 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) .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, |