diff options
14 files changed, 265 insertions, 255 deletions
diff --git a/packages/SystemUI/res/color/notification_guts_priority_button_bg_fill.xml b/packages/SystemUI/res/color/notification_guts_priority_button_bg_fill.xml new file mode 100644 index 000000000000..8ef1bf9ca583 --- /dev/null +++ b/packages/SystemUI/res/color/notification_guts_priority_button_bg_fill.xml @@ -0,0 +1,21 @@ +<!-- + ~ Copyright (C) 2019 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 + --> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_selected="true" + android:color="@color/notification_guts_priority_button_bg_fill_color_selected" /> + <item android:color="@color/notification_guts_priority_button_bg_fill_color" /> +</selector> diff --git a/packages/SystemUI/res/color/notification_guts_priority_button_bg_stroke.xml b/packages/SystemUI/res/color/notification_guts_priority_button_bg_stroke.xml new file mode 100644 index 000000000000..7964609f62e0 --- /dev/null +++ b/packages/SystemUI/res/color/notification_guts_priority_button_bg_stroke.xml @@ -0,0 +1,21 @@ +<!-- + ~ Copyright (C) 2019 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 + --> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_selected="true" + android:color="@color/notification_guts_priority_button_bg_stroke_color_selected" /> + <item android:color="@color/notification_guts_priority_button_bg_stroke_color" /> +</selector> diff --git a/packages/SystemUI/res/color/notification_guts_priority_contents.xml b/packages/SystemUI/res/color/notification_guts_priority_contents.xml new file mode 100644 index 000000000000..56c43f0e5642 --- /dev/null +++ b/packages/SystemUI/res/color/notification_guts_priority_contents.xml @@ -0,0 +1,21 @@ +<!-- + ~ Copyright (C) 2019 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. + --> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_selected="true" + android:color="@color/notification_guts_priority_button_content_color_selected" /> + <item android:color="@color/notification_guts_priority_button_content_color" /> +</selector> diff --git a/packages/SystemUI/res/drawable/button_border_selected.xml b/packages/SystemUI/res/drawable/button_border_selected.xml deleted file mode 100644 index 01e7099844a9..000000000000 --- a/packages/SystemUI/res/drawable/button_border_selected.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2019 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_selection_bg" /> - <stroke - android:width="1dp" - android:color="@color/GM2_grey_300"/> - <corners android:radius="@dimen/rect_button_radius" /> -</shape>
\ No newline at end of file diff --git a/packages/SystemUI/res/drawable/button_border_unselected.xml b/packages/SystemUI/res/drawable/button_border_unselected.xml deleted file mode 100644 index b9c4ced3631b..000000000000 --- a/packages/SystemUI/res/drawable/button_border_unselected.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2019 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" - android:color="@color/notification_guts_selection_bg"> - <stroke - android:width="1dp" - android:color="@color/GM2_grey_300"/> - - <corners android:radius="@dimen/rect_button_radius" /> -</shape>
\ No newline at end of file diff --git a/packages/SystemUI/res/drawable/button_ripple_radius.xml b/packages/SystemUI/res/drawable/button_ripple_radius.xml deleted file mode 100644 index 5c2857a4765c..000000000000 --- a/packages/SystemUI/res/drawable/button_ripple_radius.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2019 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="?android:attr/colorControlHighlight"> - <item android:id="@android:id/mask"> - <shape android:shape="rectangle"> - <solid android:color="@color/notification_guts_selection_bg" /> - <corners android:radius="@dimen/rect_button_radius" /> - </shape> - </item> -</ripple>
\ No newline at end of file diff --git a/packages/SystemUI/res/drawable/notification_guts_priority_button_bg.xml b/packages/SystemUI/res/drawable/notification_guts_priority_button_bg.xml new file mode 100644 index 000000000000..a0e025fb9bb7 --- /dev/null +++ b/packages/SystemUI/res/drawable/notification_guts_priority_button_bg.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2019 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="1dp" + android:color="@color/notification_guts_priority_button_bg_stroke" /> + + <corners android:radius="@dimen/rect_button_radius" /> +</shape> diff --git a/packages/SystemUI/res/layout/notification_info.xml b/packages/SystemUI/res/layout/notification_info.xml index 4b672ee0733f..8ffa2d83cfa2 100644 --- a/packages/SystemUI/res/layout/notification_info.xml +++ b/packages/SystemUI/res/layout/notification_info.xml @@ -219,106 +219,127 @@ asked for it --> android:gravity="center" android:orientation="vertical"> - <RelativeLayout + <LinearLayout android:id="@+id/alert" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="@dimen/notification_importance_button_padding" android:clickable="true" - android:focusable="true"> - <ImageView - android:id="@+id/alert_icon" - android:src="@drawable/ic_notifications_alert" - android:background="@android:color/transparent" - android:layout_gravity="center" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:clickable="false" - android:focusable="false"/> - <TextView - android:id="@+id/alert_label" + android:focusable="true" + android:background="@drawable/notification_guts_priority_button_bg" + android:orientation="vertical"> + <LinearLayout 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/alert_icon" - android:layout_marginStart="@dimen/notification_importance_drawable_padding" - android:textAppearance="@style/TextAppearance.NotificationImportanceButton.Unselected" - android:text="@string/notification_alert_title"/> + android:orientation="horizontal" + android:gravity="center" + > + <ImageView + android:id="@+id/alert_icon" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/ic_notifications_alert" + android:background="@android:color/transparent" + android:tint="@color/notification_guts_priority_contents" + android:clickable="false" + android:focusable="false"/> + <TextView + android:id="@+id/alert_label" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="@dimen/notification_importance_drawable_padding" + 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"/> + </LinearLayout> <TextView android:id="@+id/alert_summary" - android:visibility="gone" - android:paddingTop="@dimen/notification_importance_button_padding" - android:text="@string/notification_channel_summary_default" 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_default" android:clickable="false" android:focusable="false" android:ellipsize="end" android:maxLines="2" - android:layout_below="@id/alert_icon" android:textAppearance="@style/TextAppearance.NotificationImportanceDetail"/> - </RelativeLayout> + </LinearLayout> - <RelativeLayout + <LinearLayout android:id="@+id/silence" android:layout_width="match_parent" android:layout_height="wrap_content" - android:padding="@dimen/notification_importance_button_padding" android:layout_marginTop="@dimen/notification_importance_button_separation" + android:padding="@dimen/notification_importance_button_padding" android:clickable="true" - android:focusable="true"> - <ImageView - android:id="@+id/silence_icon" - android:src="@drawable/ic_notifications_silence" - android:background="@android:color/transparent" - android:layout_gravity="center" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:clickable="false" - android:focusable="false"/> - <TextView - android:id="@+id/silence_label" + android:focusable="true" + android:background="@drawable/notification_guts_priority_button_bg" + android:orientation="vertical"> + <LinearLayout 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:layout_marginStart="@dimen/notification_importance_drawable_padding" - android:textAppearance="@style/TextAppearance.NotificationImportanceButton.Unselected" - android:text="@string/notification_silence_title"/> + android:orientation="horizontal" + android:gravity="center" + > + <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:clickable="false" + android:focusable="false"/> + <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:layout_marginStart="@dimen/notification_importance_drawable_padding" + android:textAppearance="@style/TextAppearance.NotificationImportanceButton" + android:text="@string/notification_silence_title"/> + </LinearLayout> <TextView android:id="@+id/silence_summary" - android:visibility="gone" - android:paddingTop="@dimen/notification_importance_button_padding" - android:text="@string/notification_channel_summary_default" 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_low" android:clickable="false" android:focusable="false" android:ellipsize="end" android:maxLines="2" - android:layout_below="@id/silence_icon" android:textAppearance="@style/TextAppearance.NotificationImportanceDetail"/> - </RelativeLayout> + </LinearLayout> </LinearLayout> <RelativeLayout android:id="@+id/bottom_buttons" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="@dimen/notification_guts_button_spacing" > + android:layout_height="60dp" + android:gravity="center_vertical" + android:paddingStart="4dp" + android:paddingEnd="4dp" + > <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_alignParentStart="true" + android:gravity="start|center_vertical" android:minWidth="@dimen/notification_importance_toggle_size" android:minHeight="@dimen/notification_importance_toggle_size" android:maxWidth="200dp" @@ -329,10 +350,10 @@ asked for it --> android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentEnd="true" - android:gravity="center_vertical|end" - android:maxWidth="125dp" + android:gravity="end|center_vertical" android:minWidth="@dimen/notification_importance_toggle_size" android:minHeight="@dimen/notification_importance_toggle_size" + android:maxWidth="125dp" style="@style/TextAppearance.NotificationInfo.Button"/> </RelativeLayout> diff --git a/packages/SystemUI/res/values-night/colors.xml b/packages/SystemUI/res/values-night/colors.xml index addc10aaeff6..dd3073fb5e65 100644 --- a/packages/SystemUI/res/values-night/colors.xml +++ b/packages/SystemUI/res/values-night/colors.xml @@ -42,12 +42,16 @@ <!-- The color of the text inside a notification --> <color name="notification_primary_text_color">@*android:color/notification_primary_text_color_dark</color> - <color name="notification_guts_selection_bg">@color/GM2_grey_800</color> - <color name="notification_guts_selection_border">@color/GM2_grey_700</color> <color name="notification_guts_link_icon_tint">@color/GM2_grey_500</color> - <color name="notification_guts_sub_text_color">@color/GM2_grey_200</color> + <color name="notification_guts_sub_text_color">@color/GM2_grey_500</color> <color name="notification_guts_header_text_color">@color/GM2_grey_200</color> - <color name="notification_guts_button_color">@color/GM2_blue_200</color> + <color name="notification_guts_info_button_color">@color/GM2_blue_300</color> + <color name="notification_guts_priority_button_content_color">@color/GM2_grey_500</color> + <color name="notification_guts_priority_button_content_color_selected">@color/GM2_blue_300</color> + <color name="notification_guts_priority_button_bg_fill_color">@color/transparent</color> + <color name="notification_guts_priority_button_bg_fill_color_selected">@color/GM2_grey_800</color> + <color name="notification_guts_priority_button_bg_stroke_color">@color/GM2_grey_700</color> + <color name="notification_guts_priority_button_bg_stroke_color_selected">@color/GM2_grey_700</color> <color name="notification_section_header_label_color">@color/GM2_grey_200</color> <color name="notification_section_clear_all_btn_color">@color/GM2_grey_500</color> diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index f41566178d33..3f84b32ee0c2 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -91,14 +91,18 @@ <!-- The "inside" of a notification, reached via longpress --> <color name="notification_guts_bg_color">@color/GM2_grey_50</color> - <color name="notification_guts_selection_bg">#FFFFFF</color> - <color name="notification_guts_selection_border">#4285F4</color> <color name="notification_guts_link_icon_tint">@color/GM2_grey_700</color> <color name="notification_guts_sub_text_color">@color/GM2_grey_700</color> <color name="notification_guts_header_text_color">@color/GM2_grey_900</color> <color name="notification_silence_color">#FF32c1de</color> <color name="notification_alert_color">#FFF87B2B</color> - <color name="notification_guts_button_color">@color/GM2_blue_700</color> + <color name="notification_guts_info_button_color">@color/GM2_blue_700</color> + <color name="notification_guts_priority_button_content_color">@color/GM2_grey_700</color> + <color name="notification_guts_priority_button_content_color_selected">@color/GM2_blue_700</color> + <color name="notification_guts_priority_button_bg_fill_color">@color/transparent</color> + <color name="notification_guts_priority_button_bg_fill_color_selected">#FFFFFF</color> + <color name="notification_guts_priority_button_bg_stroke_color">@color/GM2_grey_300</color> + <color name="notification_guts_priority_button_bg_stroke_color_selected">@color/GM2_blue_600</color> <color name="notification_section_header_label_color">@color/GM2_grey_900</color> <color name="notification_section_clear_all_btn_color">@color/GM2_grey_700</color> @@ -188,6 +192,8 @@ <color name="GM2_red_700">#C5221F</color> <color name="GM2_blue_200">#AECBFA</color> + <color name="GM2_blue_300">#8AB4F8</color> + <color name="GM2_blue_600">#1A73E8</color> <color name="GM2_blue_700">#1967D2</color> <color name="GM2_yellow_500">#FFFBBC04</color> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index b27836d640d8..19874948cb54 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -218,7 +218,7 @@ <dimen name="notification_guts_option_horizontal_padding">15dp</dimen> <!-- The vertical space between items in the alert selections in the inline settings --> - <dimen name="notification_guts_option_vertical_padding">20dp</dimen> + <dimen name="notification_guts_option_vertical_padding">16dp</dimen> <!-- The vertical space between the alert selections in the inline settings --> <dimen name="notification_guts_option_vertical_margin">6dp</dimen> @@ -227,7 +227,7 @@ <dimen name="notification_importance_toggle_marginTop">28dp</dimen> <dimen name="notification_importance_toggle_marginBottom">28dp</dimen> <dimen name="notification_importance_text_marginTop">20dp</dimen> - <dimen name="notification_importance_button_separation">16dp</dimen> + <dimen name="notification_importance_button_separation">8dp</dimen> <dimen name="notification_importance_button_width">178dp</dimen> <dimen name="notification_importance_button_horiz_padding">28dp</dimen> <dimen name="notification_importance_drawable_padding">8dp</dimen> @@ -236,8 +236,9 @@ <dimen name="notification_importance_description_text">14sp</dimen> <dimen name="notification_importance_channel_text">16sp</dimen> <dimen name="notification_importance_channel_group_text">14sp</dimen> - <dimen name="notification_importance_button_text">16sp</dimen> - <dimen name="notification_importance_button_padding">14dp</dimen> + <dimen name="notification_importance_button_text">14sp</dimen> + <dimen name="notification_importance_button_padding">16dp</dimen> + <dimen name="notification_importance_button_description_top_margin">12dp</dimen> <dimen name="rect_button_radius">8dp</dimen> <!-- The minimum height for the snackbar shown after the snooze option has been chosen. --> diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 98312505b80d..8bc84c6d4a44 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -1677,25 +1677,16 @@ <string name="inline_keep_showing_app">Keep showing notifications from this app?</string> <!-- [CHAR LIMIT=100] Notification Importance title --> - <string name="notification_silence_title">Gentle</string> + <string name="notification_silence_title">Silent</string> <!-- [CHAR LIMIT=100] Notification Importance title --> - <string name="notification_alert_title">Prioritized</string> + <string name="notification_alert_title">Alerting</string> <!-- [CHAR LIMIT=150] Notification Importance title: low importance level summary --> - <string name="notification_channel_summary_low">Helps you focus with notifications only in the pull-down shade. Always silent.</string> - - <!-- [CHAR LIMIT=150] Notification Importance title: low importance level summary --> - <string name="notification_channel_summary_low_status">Displays below priority notifications. Always silent.</string> - - <!-- [CHAR LIMIT=150] Notification Importance title: low importance level summary --> - <string name="notification_channel_summary_low_lock">Displays below priority notifications. Always silent.</string> - - <!-- [CHAR LIMIT=150] Notification Importance title: low importance level summary --> - <string name="notification_channel_summary_low_status_lock">Displays below priority notifications. Always silent.</string> + <string name="notification_channel_summary_low">Helps you focus without sound or vibration.</string> <!-- [CHAR LIMIT=150] Notification Importance title: normal importance level summary --> - <string name="notification_channel_summary_default">Gets your attention with sound & a status bar icon. Shows on lock screen.</string> + <string name="notification_channel_summary_default">Gets your attention with sound or vibration.</string> <!-- Notification: Control panel: Label that displays when the app's notifications cannot be blocked. --> <string name="notification_unblockable_desc">These notifications can\'t be modified.</string> diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index a2b9299be5ec..b3877931bd4f 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -460,9 +460,9 @@ </style> <style name="TextAppearance.NotificationInfo.Button"> - <item name="android:fontFamily">@*android:string/config_bodyFontFamilyMedium</item> - <item name="android:textSize">16sp</item> - <item name="android:textColor">@color/notification_guts_button_color</item> + <item name="android:fontFamily">@*android:string/config_headlineFontFamilyMedium</item> + <item name="android:textSize">14sp</item> + <item name="android:textColor">@color/notification_guts_info_button_color</item> <item name="android:background">@drawable/btn_borderless_rect</item> <item name="android:gravity">center_vertical</item> <item name="android:focusable">true</item> @@ -470,21 +470,21 @@ <style name="TextAppearance.NotificationImportanceChannel"> <item name="android:textSize">@dimen/notification_importance_channel_text</item> - <item name="android:fontFamily">@*android:string/config_bodyFontFamilyMedium</item> + <item name="android:fontFamily">@*android:string/config_headlineFontFamilyMedium</item> <item name="android:textColor">@color/notification_guts_header_text_color</item> <item name="android:textSize">@dimen/notification_importance_channel_text</item> </style> <style name="TextAppearance.NotificationImportanceChannelGroup"> <item name="android:textSize">@dimen/notification_importance_channel_group_text</item> - <item name="android:fontFamily">@*android:string/config_bodyFontFamily</item> + <item name="android:fontFamily">@*android:string/config_headlineFontFamily</item> <item name="android:textColor">@color/notification_guts_sub_text_color</item> <item name="android:textSize">@dimen/notification_importance_channel_group_text</item> </style> <style name="TextAppearance.NotificationImportanceHeader"> <item name="android:textSize">@dimen/notification_importance_header_text</item> - <item name="android:fontFamily">@*android:string/config_bodyFontFamily</item> + <item name="android:fontFamily">@*android:string/config_headlineFontFamily</item> <item name="android:textColor">@color/notification_guts_header_text_color</item> </style> @@ -497,18 +497,11 @@ <style name="TextAppearance.NotificationImportanceButton"> <item name="android:textSize">@dimen/notification_importance_button_text</item> - <item name="android:fontFamily">@*android:string/config_bodyFontFamilyMedium</item> + <item name="android:fontFamily">@*android:string/config_headlineFontFamilyMedium</item> + <item name="android:textColor">@color/notification_guts_priority_contents</item> <item name="android:gravity">center</item> </style> - <style name="TextAppearance.NotificationImportanceButton.Selected" parent="TextAppearance.NotificationImportanceButton"> - <item name="android:textColor">?android:attr/colorAccent</item> - </style> - - <style name="TextAppearance.NotificationImportanceButton.Unselected" parent="TextAppearance.NotificationImportanceButton"> - <item name="android:textColor">?android:attr/textColorPrimary</item> - </style> - <style name="TextAppearance.HeadsUpStatusBarText" parent="@*android:style/TextAppearance.DeviceDefault.Notification.Info"> </style> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInfo.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInfo.java index e4e8c80867b1..1dc96b82f4a5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInfo.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInfo.java @@ -20,6 +20,10 @@ import static android.app.NotificationManager.IMPORTANCE_DEFAULT; import static android.app.NotificationManager.IMPORTANCE_LOW; import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED; +import static com.android.systemui.Interpolators.FAST_OUT_SLOW_IN; + +import static java.lang.annotation.RetentionPolicy.SOURCE; + import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; @@ -40,11 +44,12 @@ import android.graphics.drawable.Drawable; import android.metrics.LogMaker; import android.os.Handler; import android.os.RemoteException; -import android.provider.Settings; import android.service.notification.StatusBarNotification; import android.text.TextUtils; -import android.transition.AutoTransition; +import android.transition.ChangeBounds; +import android.transition.Fade; import android.transition.TransitionManager; +import android.transition.TransitionSet; import android.util.AttributeSet; import android.util.Log; import android.view.View; @@ -62,6 +67,7 @@ import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.statusbar.notification.logging.NotificationCounters; +import java.lang.annotation.Retention; import java.util.List; import java.util.Set; @@ -92,9 +98,8 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G // standard controls private static final int ACTION_ALERT = 5; - private static final int BUTTON_ANIM_TIME_MS = 200; - - private static final boolean SHOW_BUTTON_SUMMARY = false; + private TextView mPriorityDescriptionView; + private TextView mSilentDescriptionView; private INotificationManager mINotificationManager; private PackageManager mPm; @@ -110,8 +115,6 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G private NotificationChannel mSingleNotificationChannel; private int mStartingChannelImportance; private boolean mWasShownHighPriority; - private boolean mShowOnLockscreen; - private boolean mShowInStatusBar; private boolean mPressedApply; /** @@ -129,8 +132,6 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G private OnSettingsClickListener mOnSettingsClickListener; private OnAppSettingsClickListener mAppSettingsClickListener; private NotificationGuts mGutsContainer; - private Drawable mSelectedBackground; - private Drawable mUnselectedBackground; private Drawable mPkgIcon; /** Whether this view is being shown as part of the blocking helper. */ @@ -145,16 +146,14 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G private OnClickListener mOnAlert = v -> { mExitReason = NotificationCounters.BLOCKING_HELPER_KEEP_SHOWING; mChosenImportance = IMPORTANCE_DEFAULT; - setImportanceSummary(ACTION_ALERT, true); - updateButtons(ACTION_ALERT); + applyAlertingBehavior(BEHAVIOR_ALERTING, true /* userTriggered */); }; // used by standard ui private OnClickListener mOnSilent = v -> { mExitReason = NotificationCounters.BLOCKING_HELPER_DELIVER_SILENTLY; mChosenImportance = IMPORTANCE_LOW; - setImportanceSummary(ACTION_TOGGLE_SILENT, true); - updateButtons(ACTION_TOGGLE_SILENT); + applyAlertingBehavior(BEHAVIOR_SILENT, true /* userTriggered */); }; // used by standard ui @@ -218,6 +217,14 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G super(context, attrs); } + @Override + protected void onFinishInflate() { + super.onFinishInflate(); + + mPriorityDescriptionView = findViewById(R.id.alert_summary); + mSilentDescriptionView = findViewById(R.id.silence_summary); + } + // Specify a CheckSaveListener to override when/if the user's changes are committed. public interface CheckSaveListener { // Invoked when importance has changed and the NotificationInfo wants to try to save it. @@ -293,9 +300,6 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G mDelegatePkg = mSbn.getOpPkg(); mIsDeviceProvisioned = isDeviceProvisioned; - mSelectedBackground = mContext.getDrawable(R.drawable.button_border_selected); - mUnselectedBackground = mContext.getDrawable(R.drawable.button_border_unselected); - int numTotalChannels = mINotificationManager.getNumNotificationChannelsForPackage( pkg, mAppUid, false /* includeDeleted */); if (mNumUniqueChannelsInRow == 0) { @@ -308,11 +312,6 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G && numTotalChannels == 1; } - mShowInStatusBar = !mINotificationManager.shouldHideSilentStatusIcons( - mContext.getPackageName()); - mShowOnLockscreen = Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS, 0) == 1; - bindHeader(); bindChannelDetails(); @@ -376,13 +375,9 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G silent.setOnClickListener(mOnSilent); alert.setOnClickListener(mOnAlert); - if (mWasShownHighPriority) { - updateButtons(ACTION_ALERT); - setImportanceSummary(ACTION_ALERT, false); - } else { - updateButtons(ACTION_TOGGLE_SILENT); - setImportanceSummary(ACTION_TOGGLE_SILENT, false); - } + applyAlertingBehavior( + mWasShownHighPriority ? BEHAVIOR_ALERTING : BEHAVIOR_SILENT, + false /* userTriggered */); } private void bindHeader() { @@ -545,66 +540,45 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G } } - private void updateButtons(int blockState) { - View silence = findViewById(R.id.silence); + private void applyAlertingBehavior(@AlertingBehavior int behavior, boolean userTriggered) { + if (userTriggered) { + TransitionSet transition = new TransitionSet(); + transition.setOrdering(TransitionSet.ORDERING_TOGETHER); + transition.addTransition(new Fade(Fade.OUT)) + .addTransition(new ChangeBounds()) + .addTransition( + new Fade(Fade.IN) + .setStartDelay(150) + .setDuration(200) + .setInterpolator(FAST_OUT_SLOW_IN)); + transition.setDuration(350); + transition.setInterpolator(FAST_OUT_SLOW_IN); + TransitionManager.beginDelayedTransition(this, transition); + } + View alert = findViewById(R.id.alert); - TextView done = findViewById(R.id.done); - switch (blockState) { - case ACTION_TOGGLE_SILENT: - updateButtons(silence, alert); - if (mWasShownHighPriority) { - done.setText(R.string.inline_ok_button); - } else { - done.setText(R.string.inline_done_button); - } + View silence = findViewById(R.id.silence); + + switch (behavior) { + case BEHAVIOR_ALERTING: + alert.setSelected(true); + silence.setSelected(false); + mPriorityDescriptionView.setVisibility(VISIBLE); + mSilentDescriptionView.setVisibility(GONE); break; - case ACTION_ALERT: - updateButtons(alert, silence); - if (mWasShownHighPriority) { - done.setText(R.string.inline_done_button); - } else { - done.setText(R.string.inline_ok_button); - } + case BEHAVIOR_SILENT: + alert.setSelected(false); + silence.setSelected(true); + mSilentDescriptionView.setVisibility(VISIBLE); + mPriorityDescriptionView.setVisibility(GONE); break; + default: + throw new IllegalArgumentException("Unrecognized alerting behavior: " + behavior); } - } - - private void updateButtons(View selected, View unselected) { - selected.setBackground(mSelectedBackground); - selected.setSelected(true); - unselected.setBackground(mUnselectedBackground); - unselected.setSelected(false); - } - void setImportanceSummary(int blockState, boolean userTriggered) { - if (userTriggered) { - AutoTransition transition = new AutoTransition(); - transition.setDuration(BUTTON_ANIM_TIME_MS); - TransitionManager.beginDelayedTransition(this, transition); - } - if (SHOW_BUTTON_SUMMARY) { - if (blockState == ACTION_ALERT) { - TextView view = findViewById(R.id.alert_summary); - view.setVisibility(VISIBLE); - findViewById(R.id.silence_summary).setVisibility(GONE); - view.setText(R.string.notification_channel_summary_default); - } else { - TextView view = findViewById(R.id.silence_summary); - view.setVisibility(VISIBLE); - findViewById(R.id.alert_summary).setVisibility(GONE); - if (mShowInStatusBar) { - if (mShowOnLockscreen) { - view.setText(R.string.notification_channel_summary_low_status_lock); - } else { - view.setText(R.string.notification_channel_summary_low_status); - } - } else if (mShowOnLockscreen) { - view.setText(R.string.notification_channel_summary_low_lock); - } else { - view.setText(R.string.notification_channel_summary_low); - } - } - } + boolean isAChange = mWasShownHighPriority != (behavior == BEHAVIOR_ALERTING); + TextView done = findViewById(R.id.done); + done.setText(isAChange ? R.string.inline_ok_button : R.string.inline_done_button); } private void saveImportanceAndExitReason(@NotificationInfoAction int action) { @@ -883,4 +857,10 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G .setSubtype(mIsForBlockingHelper ? MetricsEvent.BLOCKING_HELPER_DISPLAY : MetricsEvent.BLOCKING_HELPER_UNKNOWN); } + + @Retention(SOURCE) + @IntDef({BEHAVIOR_ALERTING, BEHAVIOR_SILENT}) + private @interface AlertingBehavior {} + private static final int BEHAVIOR_ALERTING = 0; + private static final int BEHAVIOR_SILENT = 1; } |