Skip to content

Commit

Permalink
[Snackbar] Changed dimens according to spec
Browse files Browse the repository at this point in the history
Resolves #1711
Resolves #1721

GIT_ORIGIN_REV_ID=c039075b65833724b59ecdfde1ba70ed8ae5b8eb
Co-authored-by: pekingme <pekingme@gmail.com>
PiperOrigin-RevId: 333292492
  • Loading branch information
gabrielemariotti authored and pekingme committed Sep 23, 2020
1 parent fe470c0 commit 391d1f8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,6 @@

<item name="mtrl_btn_letter_spacing" format="float" type="dimen">0.07</item>

<dimen name="mtrl_btn_snackbar_margin_horizontal">8dp</dimen>

</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
style="?attr/snackbarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/design_snackbar_extra_spacing_horizontal"
android:layout_marginLeft="@dimen/design_snackbar_extra_spacing_horizontal"
android:layout_gravity="center_vertical|right|end"
android:minWidth="48dp"
android:visibility="gone"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
<dimen name="design_snackbar_background_corner_radius">0dp</dimen>

<dimen name="design_snackbar_padding_horizontal">12dp</dimen>
<dimen name="mtrl_snackbar_padding_horizontal">8dp</dimen>
<dimen name="mtrl_snackbar_message_margin_horizontal">8dp</dimen>

<!-- Extra spacing between the action and message views -->
<dimen name="design_snackbar_extra_spacing_horizontal">0dp</dimen>
Expand All @@ -32,7 +34,7 @@
<dimen name="design_snackbar_text_size">14sp</dimen>

<dimen name="design_snackbar_padding_vertical">14dp</dimen>
<dimen name="design_snackbar_padding_vertical_2lines">24dp</dimen>
<dimen name="design_snackbar_padding_vertical_2lines">16dp</dimen>

<item name="design_snackbar_action_text_color_alpha" format="float" type="dimen">1.0</item>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,25 @@
<item name="actionTextColorAlpha">@dimen/design_snackbar_action_text_color_alpha</item>
</style>

<style name="Widget.MaterialComponents.Snackbar" parent="Widget.Design.Snackbar">
<style name="Base.Widget.MaterialComponents.Snackbar" parent="Widget.Design.Snackbar">
<!--
The snackbar view has a 8dp padding on left and right. Message Textview has a 8dp margin on left and right.
-->
<item name="android:paddingLeft">@dimen/mtrl_snackbar_padding_horizontal</item>
<item name="android:paddingRight">@dimen/mtrl_snackbar_padding_horizontal</item>
<item name="backgroundOverlayColorAlpha">@dimen/mtrl_snackbar_background_overlay_color_alpha</item>
<item name="actionTextColorAlpha">@dimen/mtrl_snackbar_action_text_color_alpha</item>
</style>

<style name="Widget.MaterialComponents.Snackbar" parent="Base.Widget.MaterialComponents.Snackbar">
<!-- Null out the background here so the programmatically defined default Snackbar background
will be used, which supports the Material color theming attributes. -->
<item name="android:background">@null</item>
<item name="android:layout_margin">@dimen/mtrl_snackbar_margin</item>
<item name="animationMode">fade</item>
<item name="backgroundOverlayColorAlpha">@dimen/mtrl_snackbar_background_overlay_color_alpha</item>
<item name="actionTextColorAlpha">@dimen/mtrl_snackbar_action_text_color_alpha</item>
</style>

<style name="Widget.MaterialComponents.Snackbar.FullWidth" parent="Widget.Design.Snackbar">
<item name="backgroundOverlayColorAlpha">@dimen/mtrl_snackbar_background_overlay_color_alpha</item>
<item name="actionTextColorAlpha">@dimen/mtrl_snackbar_action_text_color_alpha</item>
</style>
<style name="Widget.MaterialComponents.Snackbar.FullWidth" parent="Base.Widget.MaterialComponents.Snackbar"/>

<style name="Widget.MaterialComponents.Snackbar.TextView" parent="Widget.AppCompat.TextView">
<item name="android:alpha">@dimen/material_emphasis_high_type</item>
Expand All @@ -57,8 +62,8 @@
<item name="android:textColor">?attr/colorSurface</item>
<item name="android:paddingTop">@dimen/design_snackbar_padding_vertical</item>
<item name="android:paddingBottom">@dimen/design_snackbar_padding_vertical</item>
<item name="android:paddingLeft">@dimen/design_snackbar_padding_horizontal</item>
<item name="android:paddingRight">@dimen/design_snackbar_padding_horizontal</item>
<item name="android:layout_marginLeft">@dimen/mtrl_snackbar_message_margin_horizontal</item>
<item name="android:layout_marginRight">@dimen/mtrl_snackbar_message_margin_horizontal</item>
</style>

</resources>

0 comments on commit 391d1f8

Please sign in to comment.