summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMartin Nordholts <martin.nordholts@sonyericsson.com>2010-06-15 16:17:24 +0200
committerJean-Baptiste Queru <jbq@google.com>2010-06-15 12:05:17 -0700
commite429c5ec9d52a5e9af9133f5de9f1002f04aede1 (patch)
tree2d4c26ad8f1b59754d9714e3a5634dadb1d96a76 /core
parente82ff9ed14811755810b3d72a1acb528dc6e6795 (diff)
downloadframeworks_base-e429c5ec9d52a5e9af9133f5de9f1002f04aede1.zip
frameworks_base-e429c5ec9d52a5e9af9133f5de9f1002f04aede1.tar.gz
frameworks_base-e429c5ec9d52a5e9af9133f5de9f1002f04aede1.tar.bz2
Support custom themes with AlertDialog.Builder
Add a constructor to AlertDialog.Builder with a 'theme' parameter so that e.g. the buttons in a dialog built with AlertDialog.Builder can be themed. Change-Id: Ie1b1c9706ad2146c8b64dd91fe249c6855c6ac65
Diffstat (limited to 'core')
-rw-r--r--core/java/android/app/AlertDialog.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/core/java/android/app/AlertDialog.java b/core/java/android/app/AlertDialog.java
index 20a579a..3360611 100644
--- a/core/java/android/app/AlertDialog.java
+++ b/core/java/android/app/AlertDialog.java
@@ -265,12 +265,22 @@ public class AlertDialog extends Dialog implements DialogInterface {
public static class Builder {
private final AlertController.AlertParams P;
+ private int mTheme;
/**
* Constructor using a context for this builder and the {@link AlertDialog} it creates.
*/
public Builder(Context context) {
+ this(context, com.android.internal.R.style.Theme_Dialog_Alert);
+ }
+
+ /**
+ * Constructor using a context and theme for this builder and
+ * the {@link AlertDialog} it creates.
+ */
+ public Builder(Context context, int theme) {
P = new AlertController.AlertParams(context);
+ mTheme = theme;
}
/**
@@ -783,7 +793,7 @@ public class AlertDialog extends Dialog implements DialogInterface {
* to do and want this to be created and displayed.
*/
public AlertDialog create() {
- final AlertDialog dialog = new AlertDialog(P.mContext);
+ final AlertDialog dialog = new AlertDialog(P.mContext, mTheme);
P.apply(dialog.mAlert);
dialog.setCancelable(P.mCancelable);
dialog.setOnCancelListener(P.mOnCancelListener);