Launch nested preferences with the same theme as parent activity.
Bug: 5351628
Change-Id: Id67b81558bc6e010d6f024cdb8117424aa6b62f0
diff --git a/core/java/android/preference/PreferenceScreen.java b/core/java/android/preference/PreferenceScreen.java
index 45e3a4c..dd9dd25 100644
--- a/core/java/android/preference/PreferenceScreen.java
+++ b/core/java/android/preference/PreferenceScreen.java
@@ -25,6 +25,7 @@
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
+import android.view.Window;
import android.widget.Adapter;
import android.widget.AdapterView;
import android.widget.ListAdapter;
@@ -156,13 +157,13 @@
// Set the title bar if title is available, else no title bar
final CharSequence title = getTitle();
- Dialog dialog = mDialog = new Dialog(context, TextUtils.isEmpty(title)
- ? com.android.internal.R.style.Theme_NoTitleBar
- : com.android.internal.R.style.Theme);
- dialog.setContentView(mListView);
- if (!TextUtils.isEmpty(title)) {
+ Dialog dialog = mDialog = new Dialog(context, context.getThemeResId());
+ if (TextUtils.isEmpty(title)) {
+ dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
+ } else {
dialog.setTitle(title);
}
+ dialog.setContentView(mListView);
dialog.setOnDismissListener(this);
if (state != null) {
dialog.onRestoreInstanceState(state);