Make AlertDialog use specific styles per button
As the buttons in an alert dialog are identified with Positive,
Negative, Neutral, use the corresponding style attributes. That way,
they can be styled independently.
Style them independently in SystemUI. This allows for AlertDialog or
SystemUIDialog created with the right theme to be able to use the
default buttons with correct styling.
Test: manual (AddUserDialog)
Bug: 203666386
Change-Id: I4f292193bff5dec90f8dc229a9824d22075d5241
diff --git a/core/res/res/layout/alert_dialog.xml b/core/res/res/layout/alert_dialog.xml
index 59e56af..6869c5f 100644
--- a/core/res/res/layout/alert_dialog.xml
+++ b/core/res/res/layout/alert_dialog.xml
@@ -124,21 +124,21 @@
android:layout_width="0dip"
android:layout_gravity="start"
android:layout_weight="1"
- style="?android:attr/buttonBarButtonStyle"
+ style="?android:attr/buttonBarPositiveButtonStyle"
android:maxLines="2"
android:layout_height="wrap_content" />
<Button android:id="@+id/button3"
android:layout_width="0dip"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
- style="?android:attr/buttonBarButtonStyle"
+ style="?android:attr/buttonBarNeutralButtonStyle"
android:maxLines="2"
android:layout_height="wrap_content" />
<Button android:id="@+id/button2"
android:layout_width="0dip"
android:layout_gravity="end"
android:layout_weight="1"
- style="?android:attr/buttonBarButtonStyle"
+ style="?android:attr/buttonBarNegativeButtonStyle"
android:maxLines="2"
android:layout_height="wrap_content" />
<LinearLayout android:id="@+id/rightSpacer"
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index ff299ea..3a6022f 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -419,6 +419,9 @@
<style name="Theme.SystemUI.Dialog" parent="@android:style/Theme.DeviceDefault.Light.Dialog">
<item name="android:buttonCornerRadius">28dp</item>
+ <item name="android:buttonBarPositiveButtonStyle">@style/Widget.QSDialog.Button</item>
+ <item name="android:buttonBarNegativeButtonStyle">@style/Widget.QSDialog.Button.BorderButton</item>
+ <item name="android:buttonBarNeutralButtonStyle">@style/Widget.QSDialog.Button.BorderButton</item>
</style>
<style name="Theme.SystemUI.Dialog.Alert" parent="@*android:style/Theme.DeviceDefault.Light.Dialog.Alert" />