Apply alertDialogTheme in AppTheme to use accent color

This commit is contained in:
Phillip Hsu 2016-08-30 23:28:13 -07:00
parent d0c8abe1f1
commit 0db0d7cf7a
2 changed files with 10 additions and 4 deletions

View File

@ -57,7 +57,7 @@ public class AddLabelDialog extends AppCompatDialogFragment {
int spacingLeft = getResources().getDimensionPixelSize(R.dimen.item_padding_start);
int spacingRight = getResources().getDimensionPixelSize(R.dimen.item_padding_end);
final AlertDialog alert = new AlertDialog.Builder(getActivity(), getTheme())
final AlertDialog alert = new AlertDialog.Builder(getActivity())
.setTitle(R.string.label)
.setView(mEditText, spacingLeft, 0, spacingRight, 0)
.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {

View File

@ -7,7 +7,8 @@
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<!-- TODO: This doesn't work for BottomSheetDialogs. Verify this works for other types of dialogs. -->
<item name="dialogTheme">@style/AppCompatDialogTheme</item>
<!--<item name="dialogTheme">@style/AppCompatDialogTheme</item>-->
<item name="alertDialogTheme">@style/AppCompatAlertDialogStyle</item>
<item name="bottomSheetDialogTheme">@style/BottomSheetDialogTheme</item>
</style>
@ -114,9 +115,14 @@
<!-- Style for AppCompatDialog from the v7 support library -->
<style name="AppCompatDialogTheme" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">?android:attr/colorAccent</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<!-- Trying to use the colorAccent attribute (whether from ?android:attr or ?attr) WILL CRASH.-->
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="BottomSheetDialogTheme" parent="Theme.Design.Light.BottomSheetDialog">
<item name="bottomSheetStyle">@style/ModalStyle</item>
</style>