Skip to content

Commit

Permalink
[M3][Dialog] Fix dialog paddings
Browse files Browse the repository at this point in the history
We missed to include top/bottom insets of button styles into dialog action margin calculation. Also the paddings between titles and messages were not correct.

PiperOrigin-RevId: 417626927
(cherry picked from commit 672e744)
  • Loading branch information
drchen authored and dsn5ft committed Jan 12, 2022
1 parent 4376067 commit 6a914c3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,21 @@

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


<!-- LINT.IfChange -->
<dimen name="m3_btn_inset">4dp</dimen>
<!-- LINT.ThenChange(../../../dialog/res/values/dimens.xml) -->

<dimen name="m3_btn_max_width">320dp</dimen>
<dimen name="m3_btn_stroke_size">1dp</dimen>
<dimen name="m3_btn_padding_left">24dp</dimen>
<dimen name="m3_btn_padding_right">24dp</dimen>

<!-- LINT.IfChange -->
<dimen name="m3_btn_padding_top">6dp</dimen>
<dimen name="m3_btn_padding_bottom">6dp</dimen>
<!-- LINT.ThenChange(../../../dialog/res/values/dimens.xml) -->

<dimen name="m3_btn_elevation">0dp</dimen>
<dimen name="m3_btn_elevated_btn_elevation">1dp</dimen>
<dimen name="m3_btn_icon_btn_padding_left">16dp</dimen>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
android:orientation="horizontal"
android:paddingLeft="?attr/dialogPreferredPadding"
android:paddingRight="?attr/dialogPreferredPadding"
android:paddingTop="18dp"
android:paddingBottom="18dp">
android:paddingTop="@dimen/m3_alert_dialog_action_top_padding"
android:paddingBottom="@dimen/m3_alert_dialog_action_bottom_padding">

<Button
android:id="@android:id/button3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,10 @@
<dimen name="m3_alert_dialog_corner_size">28dp</dimen>
<dimen name="m3_alert_dialog_icon_size">24dp</dimen>
<dimen name="m3_alert_dialog_icon_margin">16dp</dimen>
<dimen name="m3_alert_dialog_title_bottom_margin">10dp</dimen>
<dimen name="m3_alert_dialog_title_bottom_margin">16dp</dimen>

<!-- equals 24dp - @dimen/m3_btn_padding_top (6dp) - @dimen/m3_btn_inset (4dp) -->
<dimen name="m3_alert_dialog_action_top_padding">14dp</dimen>
<!-- equals 24dp - @dimen/m3_btn_padding_bottom (6dp) - @dimen/m3_btn_inset (4dp) -->
<dimen name="m3_alert_dialog_action_bottom_padding">14dp</dimen>
</resources>

0 comments on commit 6a914c3

Please sign in to comment.