Update undo snackbar visuals
- Use accent color for action
- Update font-family to use TextTitle style
- Reduce elevation to 3dp
- Inset snackbar left/right margins more, unless we need to increase the
width to fit the text
- For largest display/font size, fallback to 2 lines and smaller font if
necessary to not cut off the label
- Remove top/bottom padding on action (b/114084048)
- Allow up to 20 char for the action (b/114317987)
Change-Id: I833c102aaac3ba3db2283997c142926c3830336d
diff --git a/res/layout/snackbar.xml b/res/layout/snackbar.xml
index 419fb82..bca3308 100644
--- a/res/layout/snackbar.xml
+++ b/res/layout/snackbar.xml
@@ -25,17 +25,23 @@
android:gravity="center_vertical"
android:paddingLeft="8dp"
android:paddingRight="8dp"
- android:textSize="14sp"
- android:textColor="?android:attr/textColorPrimary"/>
+ android:lines="1"
+ android:ellipsize="end"
+ android:textSize="@dimen/snackbar_max_text_size"
+ android:textColor="?android:attr/textColorPrimary"
+ android:theme="@style/TextTitle"/>
<TextView
android:id="@+id/action"
android:layout_height="@dimen/snackbar_content_height"
android:layout_width="wrap_content"
android:layout_weight="0"
android:gravity="center"
- android:padding="8dp"
+ android:paddingLeft="8dp"
+ android:paddingRight="8dp"
android:background="?android:attr/selectableItemBackground"
android:textStyle="bold"
- android:textColor="?android:attr/textColorPrimary"
- android:textAllCaps="true"/>
+ android:textSize="@dimen/snackbar_max_text_size"
+ android:textColor="?android:attr/colorAccent"
+ android:theme="@style/TextTitle"
+ android:capitalize="sentences"/>
</merge>
\ No newline at end of file
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index e7bd64c..8adae36 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -230,5 +230,10 @@
<dimen name="snackbar_height">48dp</dimen>
<dimen name="snackbar_content_height">32dp</dimen>
<dimen name="snackbar_padding">8dp</dimen>
- <dimen name="snackbar_margin">16dp</dimen>
+ <dimen name="snackbar_min_margin_left_right">6dp</dimen>
+ <dimen name="snackbar_max_margin_left_right">72dp</dimen>
+ <dimen name="snackbar_margin_bottom">30dp</dimen>
+ <dimen name="snackbar_elevation">3dp</dimen>
+ <dimen name="snackbar_min_text_size">12sp</dimen>
+ <dimen name="snackbar_max_text_size">14sp</dimen>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6d73dcb..eb6b284 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -262,7 +262,7 @@
<!-- Accessibility confirmation for item removed. [CHAR_LIMIT=50]-->
<string name="item_removed">Item removed</string>
- <!-- Action shown in snackbar to undo item removal. [CHAR_LIMIT=15] -->
+ <!-- Action shown in snackbar to undo item removal. [CHAR_LIMIT=20] -->
<string name="undo">Undo</string>
<!-- Accessibility action to move an item on the workspace. [CHAR_LIMIT=30] -->