Skip to content

Commit 276bf9f

Browse files
authored
Fix(UI): Updated style for buttons in dialog, Closes #1753
1 parent 8b6d0ec commit 276bf9f

3 files changed

Lines changed: 25 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<inset xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:drawable="@drawable/outline_drawable_less"
4+
android:insetTop="@dimen/dialog_buttons_inset"
5+
android:insetBottom="@dimen/dialog_buttons_inset" />

app/src/main/res/values/dimens.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@
2222
<dimen name="video_frame_width">1dp</dimen>
2323

2424
<dimen name="account_select_linear_item_size">100dp</dimen>
25+
<dimen name="dialog_buttons_inset">5dp</dimen>
2526
</resources>

app/src/main/res/values/styles.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,10 @@
455455
<item name="android:windowMinWidthMinor">@dimen/abc_dialog_min_width_minor</item>
456456
<item name="android:windowBackground">@drawable/dialog__window_background</item>
457457
<item name="textAllCaps">false</item>
458+
459+
<item name="buttonBarPositiveButtonStyle">@style/WhiteButton.Dialog</item>
460+
<item name="buttonBarNegativeButtonStyle">@style/BlackButton.Dialog</item>
461+
<item name="buttonBarNeutralButtonStyle">@style/BlackButton.Dialog</item>
458462
</style>
459463

460464
<style name="TabNoCaps" parent="TextAppearance.Design.Tab">
@@ -653,6 +657,21 @@
653657
<item name="android:textColor">?attr/iconGrayBackground</item>
654658
<item name="rippleColor">?attr/primaryBlackBackground</item>
655659
</style>
660+
<!-- This is so shit, because android has no native way to either changing the layout (android:layout) or changing the layout_height for no reason.
661+
So the only way to shrink the buttons is by using insetTop+insetBottom along with the drawable.
662+
https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/layout/alert_dialog.xml <- old xml for reference, but new use m3_alert_dialog
663+
-->
664+
<style name="BlackButton.Dialog" parent="BlackButton">
665+
<item name="android:foreground">@drawable/outline_drawable_less_inset</item>
666+
<item name="android:insetTop">@dimen/dialog_buttons_inset</item>
667+
<item name="android:insetBottom">@dimen/dialog_buttons_inset</item>
668+
</style>
669+
670+
<style name="WhiteButton.Dialog" parent="WhiteButton">
671+
<item name="android:foreground">@drawable/outline_drawable_less_inset</item>
672+
<item name="android:insetTop">@dimen/dialog_buttons_inset</item>
673+
<item name="android:insetBottom">@dimen/dialog_buttons_inset</item>
674+
</style>
656675

657676
<style name="BlackLabel" parent="@style/Widget.MaterialComponents.Tooltip">
658677
<item name="backgroundTint">?attr/iconGrayBackground</item>

0 commit comments

Comments
 (0)