Update Toast UI component according to UX reference spec
The color, size, background radius, font, and padding have all been
changed to reflect the UX specs.
Bug: 203815193
Test: Manual
Change-Id: I9cf7ae1e4afb5d383f5c99c61e6954e2c1929bc7
(cherry picked from commit 314b4823b5a99acb3fd06dbf9e66818ea0de9b9e)
diff --git a/res/layout/text_toast.xml b/res/layout/text_toast.xml
new file mode 100644
index 0000000..401b9fc
--- /dev/null
+++ b/res/layout/text_toast.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ ~ Copyright (C) 2022 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.
+ -->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="706dp"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:gravity="center_vertical"
+ android:maxHeight="160dp"
+ android:background="@android:drawable/toast_frame"
+ android:elevation="@*android:dimen/toast_elevation"
+ android:layout_marginEnd="16dp"
+ android:layout_marginStart="16dp"
+ android:paddingStart="32dp"
+ android:paddingEnd="32dp"
+ android:paddingTop="32dp"
+ android:paddingBottom="32dp">
+
+ <!-- This is needed so that toasts don't crash -->
+ <ImageView
+ android:id="@+id/icon"
+ android:visibility="gone"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ <TextView
+ android:id="@+id/text"
+ android:layout_width="642dp"
+ android:layout_height="wrap_content"
+ android:ellipsize="end"
+ android:maxLines="3"
+ android:lineHeight="32dp"
+ android:textAppearance="@style/TextAppearance.Toast"/>
+</LinearLayout>
\ No newline at end of file
diff --git a/res/values/overlayable.xml b/res/values/overlayable.xml
index 16dd140..ef0f74e 100644
--- a/res/values/overlayable.xml
+++ b/res/values/overlayable.xml
@@ -543,6 +543,7 @@
<item type="id" name="hvac_panel_stub"/>
<item type="id" name="hvac_temperature_bar"/>
<item type="id" name="hvac_temperature_text"/>
+ <item type="id" name="icon"/>
<item type="id" name="inactive_background"/>
<item type="id" name="inactive_selected_background"/>
<item type="id" name="inout_container"/>
@@ -586,6 +587,7 @@
<item type="id" name="supplemental_icon"/>
<item type="id" name="supplemental_icon_divider"/>
<item type="id" name="system_icons"/>
+ <item type="id" name="text"/>
<item type="id" name="toggle_debug_info"/>
<item type="id" name="top_guideline"/>
<item type="id" name="user_avatar"/>
@@ -679,6 +681,7 @@
<item type="layout" name="status_bar_wifi_group"/>
<item type="layout" name="system_icons"/>
<item type="layout" name="sysui_overlay_window"/>
+ <item type="layout" name="text_toast"/>
<item type="string" name="activity_blocked_text"/>
<item type="string" name="camera_privacy_chip_app_recently_used_camera_suffix"/>
<item type="string" name="camera_privacy_chip_app_using_camera_suffix"/>
@@ -753,6 +756,7 @@
<item type="style" name="TextAppearance.CarStatus"/>
<item type="style" name="TextAppearance.SystemBar.Clock"/>
<item type="style" name="TextAppearance.SystemBar.Username"/>
+ <item type="style" name="TextAppearance.Toast"/>
<item type="style" name="Theme.Notification"/>
<item type="style" name="VolumeButtons"/>
<item type="xml" name="camera_privacy_chip_scene"/>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 4dc28aa..2df569a 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -43,6 +43,13 @@
<item name="android:textColor">@color/system_bar_text_color</item>
</style>
+ <!-- The style for a Toast. -->
+ <style name="TextAppearance.Toast" parent="*android:TextAppearance">
+ <item name="android:fontFamily">Roboto</item>
+ <item name="android:textSize">24sp</item>
+ <item name="android:textColor">@android:color/white</item>
+ </style>
+
<style name="SystemBarButton">
<item name="android:layout_height">@dimen/system_bar_button_size</item>
<item name="android:layout_width">@dimen/system_bar_button_size</item>