Skip to content

Commit 766d1b7

Browse files
author
The Android Open Source Project
committed
merge from open-source master
Change-Id: I05e4c26c902f3cfe0dd99107f518768b246562f7
2 parents e5a023b + e429c5e commit 766d1b7

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

api/current.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19334,6 +19334,18 @@
1933419334
<parameter name="context" type="android.content.Context">
1933519335
</parameter>
1933619336
</constructor>
19337+
<constructor name="AlertDialog.Builder"
19338+
type="android.app.AlertDialog.Builder"
19339+
static="false"
19340+
final="false"
19341+
deprecated="not deprecated"
19342+
visibility="public"
19343+
>
19344+
<parameter name="context" type="android.content.Context">
19345+
</parameter>
19346+
<parameter name="theme" type="int">
19347+
</parameter>
19348+
</constructor>
1933719349
<method name="create"
1933819350
return="android.app.AlertDialog"
1933919351
abstract="false"

core/java/android/app/AlertDialog.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,22 @@ public boolean onKeyUp(int keyCode, KeyEvent event) {
265265

266266
public static class Builder {
267267
private final AlertController.AlertParams P;
268+
private int mTheme;
268269

269270
/**
270271
* Constructor using a context for this builder and the {@link AlertDialog} it creates.
271272
*/
272273
public Builder(Context context) {
274+
this(context, com.android.internal.R.style.Theme_Dialog_Alert);
275+
}
276+
277+
/**
278+
* Constructor using a context and theme for this builder and
279+
* the {@link AlertDialog} it creates.
280+
*/
281+
public Builder(Context context, int theme) {
273282
P = new AlertController.AlertParams(context);
283+
mTheme = theme;
274284
}
275285

276286
/**
@@ -783,7 +793,7 @@ public Builder setRecycleOnMeasureEnabled(boolean enabled) {
783793
* to do and want this to be created and displayed.
784794
*/
785795
public AlertDialog create() {
786-
final AlertDialog dialog = new AlertDialog(P.mContext);
796+
final AlertDialog dialog = new AlertDialog(P.mContext, mTheme);
787797
P.apply(dialog.mAlert);
788798
dialog.setCancelable(P.mCancelable);
789799
dialog.setOnCancelListener(P.mOnCancelListener);

0 commit comments

Comments
 (0)