Permalink
Browse files

dialog: fix AlertDialogs and ProgressDialogs

  • Loading branch information...
1 parent a64325d commit ee1e2f0415fb58e698ab9853e995e462b8bc2a16 @talklittle committed Jan 14, 2012
@@ -59,6 +59,7 @@
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
+import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@@ -1663,7 +1664,7 @@ public void onCancel(DialogInterface dialog) {
}
case Constants.DIALOG_DELETE:
- builder = new AlertDialog.Builder(this, mSettings.getDialogTheme());
+ builder = new AlertDialog.Builder(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
builder.setTitle("Really delete this?");
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
@@ -1680,7 +1681,7 @@ public void onClick(DialogInterface dialog, int id) {
break;
case Constants.DIALOG_SORT_BY:
- builder = new AlertDialog.Builder(this, mSettings.getDialogTheme());
+ builder = new AlertDialog.Builder(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
builder.setTitle("Sort by:");
int selectedSortBy = -1;
for (int i = 0; i < Constants.CommentsSort.SORT_BY_URL_CHOICES.length; i++) {
@@ -1694,7 +1695,7 @@ public void onClick(DialogInterface dialog, int id) {
break;
case Constants.DIALOG_REPORT:
- builder = new AlertDialog.Builder(this, mSettings.getDialogTheme());
+ builder = new AlertDialog.Builder(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
builder.setTitle("Really report this?");
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
@@ -1712,28 +1713,28 @@ public void onClick(DialogInterface dialog, int id) {
// "Please wait"
case Constants.DIALOG_DELETING:
- pdialog = new ProgressDialog(this, mSettings.getDialogTheme());
+ pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
pdialog.setMessage("Deleting...");
pdialog.setIndeterminate(true);
pdialog.setCancelable(false);
dialog = pdialog;
break;
case Constants.DIALOG_EDITING:
- pdialog = new ProgressDialog(this, mSettings.getDialogTheme());
+ pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
pdialog.setMessage("Submitting edit...");
pdialog.setIndeterminate(true);
pdialog.setCancelable(false);
dialog = pdialog;
break;
case Constants.DIALOG_LOGGING_IN:
- pdialog = new ProgressDialog(this, mSettings.getDialogTheme());
+ pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
pdialog.setMessage("Logging in...");
pdialog.setIndeterminate(true);
pdialog.setCancelable(false);
dialog = pdialog;
break;
case Constants.DIALOG_REPLYING:
- pdialog = new ProgressDialog(this, mSettings.getDialogTheme());
+ pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
pdialog.setMessage("Sending reply...");
pdialog.setIndeterminate(true);
pdialog.setCancelable(false);
@@ -1746,7 +1747,7 @@ public void onClick(DialogInterface dialog, int id) {
final EditText find_box = (EditText) content.findViewById(R.id.input_find_box);
// final CheckBox wrap_box = (CheckBox) content.findViewById(R.id.find_wrap_checkbox);
- builder = new AlertDialog.Builder(this, mSettings.getDialogTheme());
+ builder = new AlertDialog.Builder(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
builder.setView(content);
builder.setTitle(R.string.find)
.setPositiveButton(R.string.find, new DialogInterface.OnClickListener() {
@@ -1959,7 +1960,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
}
};
- AlertDialog.Builder b = new AlertDialog.Builder(CommentsListActivity.this, mSettings.getDialogTheme());
+ AlertDialog.Builder b = new AlertDialog.Builder(new ContextThemeWrapper(CommentsListActivity.this, mSettings.getDialogTheme()));
DialogInterface.OnClickListener click = new DialogInterface.OnClickListener() {
public final void onClick(DialogInterface dialog, int which) {
@@ -63,6 +63,7 @@
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
+import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@@ -1159,7 +1160,7 @@ public void onClick(View v) {
break;
case Constants.DIALOG_COMPOSE:
inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- builder = new AlertDialog.Builder(this, mSettings.getDialogTheme());
+ builder = new AlertDialog.Builder(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
layout = inflater.inflate(R.layout.compose_dialog, null);
dialog = builder.setView(layout).create();
final Dialog composeDialog = dialog;
@@ -1205,21 +1206,21 @@ public void onClick(View v) {
// "Please wait"
case Constants.DIALOG_LOGGING_IN:
- pdialog = new ProgressDialog(this, mSettings.getDialogTheme());
+ pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
pdialog.setMessage("Logging in...");
pdialog.setIndeterminate(true);
pdialog.setCancelable(false);
dialog = pdialog;
break;
case Constants.DIALOG_REPLYING:
- pdialog = new ProgressDialog(this, mSettings.getDialogTheme());
+ pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
pdialog.setMessage("Sending reply...");
pdialog.setIndeterminate(true);
pdialog.setCancelable(false);
dialog = pdialog;
break;
case Constants.DIALOG_COMPOSING:
- pdialog = new ProgressDialog(this, mSettings.getDialogTheme());
+ pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
pdialog.setMessage("Composing message...");
pdialog.setIndeterminate(true);
pdialog.setCancelable(false);
@@ -43,6 +43,7 @@
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
+import android.view.ContextThemeWrapper;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MenuItem;
@@ -432,7 +433,7 @@ protected Dialog onCreateDialog(int id) {
switch (id) {
// "Please wait"
case Constants.DIALOG_LOADING_REDDITS_LIST:
- pdialog = new ProgressDialog(this, mSettings.getDialogTheme());
+ pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
pdialog.setMessage("Loading your reddits...");
pdialog.setIndeterminate(true);
pdialog.setCancelable(false);
@@ -48,6 +48,7 @@
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
+import android.view.ContextThemeWrapper;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
@@ -547,14 +548,14 @@ public void onLoginChosen(String user, String password) {
// "Please wait"
case Constants.DIALOG_LOGGING_IN:
- pdialog = new ProgressDialog(this, mSettings.getDialogTheme());
+ pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
pdialog.setMessage("Logging in...");
pdialog.setIndeterminate(true);
pdialog.setCancelable(false);
dialog = pdialog;
break;
case Constants.DIALOG_SUBMITTING:
- pdialog = new ProgressDialog(this, mSettings.getDialogTheme());
+ pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
pdialog.setMessage("Submitting...");
pdialog.setIndeterminate(true);
pdialog.setCancelable(false);
@@ -46,6 +46,7 @@
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
+import android.view.ContextThemeWrapper;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -291,7 +292,7 @@ public boolean onKeyDown(int keyCode, KeyEvent event) {
//Handle the back button
if(mSettings.isConfirmQuitOrLogout() && keyCode == KeyEvent.KEYCODE_BACK && isTaskRoot()) {
//Ask the user if they want to quit
- new AlertDialog.Builder(this, mSettings.getDialogTheme())
+ new AlertDialog.Builder(new ContextThemeWrapper(this, mSettings.getDialogTheme()))
.setIcon(android.R.drawable.ic_dialog_alert)
.setTitle(R.string.quit)
.setMessage(R.string.really_quit)
@@ -1120,7 +1121,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
case R.id.logout_menu_id:
if (mSettings.isConfirmQuitOrLogout()) {
// Ask the user if they want to logout
- new AlertDialog.Builder(this, mSettings.getDialogTheme())
+ new AlertDialog.Builder(new ContextThemeWrapper(this, mSettings.getDialogTheme()))
.setIcon(android.R.drawable.ic_dialog_alert)
.setTitle(R.string.confirm_logout_title)
.setMessage(R.string.confirm_logout)
@@ -1130,7 +1131,10 @@ public void onClick(DialogInterface dialog,
int which) {
ThreadsListActivity.this.logout();
}
- }).setNegativeButton(R.string.no, null).show();
+ }
+ )
+ .setNegativeButton(R.string.no, null)
+ .show();
} else {
logout();
}
@@ -1218,28 +1222,28 @@ public void onLoginChosen(String user, String password) {
break;
case Constants.DIALOG_SORT_BY:
- builder = new AlertDialog.Builder(this, mSettings.getDialogTheme());
+ builder = new AlertDialog.Builder(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
builder.setTitle("Sort by:");
builder.setSingleChoiceItems(Constants.ThreadsSort.SORT_BY_CHOICES,
getSelectedSortBy(), sortByOnClickListener);
dialog = builder.create();
break;
case Constants.DIALOG_SORT_BY_NEW:
- builder = new AlertDialog.Builder(this, mSettings.getDialogTheme());
+ builder = new AlertDialog.Builder(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
builder.setTitle("what's new");
builder.setSingleChoiceItems(Constants.ThreadsSort.SORT_BY_NEW_CHOICES,
getSelectedSortByNew(), sortByNewOnClickListener);
dialog = builder.create();
break;
case Constants.DIALOG_SORT_BY_CONTROVERSIAL:
- builder = new AlertDialog.Builder(this, mSettings.getDialogTheme());
+ builder = new AlertDialog.Builder(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
builder.setTitle("most controversial");
builder.setSingleChoiceItems(Constants.ThreadsSort.SORT_BY_CONTROVERSIAL_CHOICES,
getSelectedSortByControversial(), sortByControversialOnClickListener);
dialog = builder.create();
break;
case Constants.DIALOG_SORT_BY_TOP:
- builder = new AlertDialog.Builder(this, mSettings.getDialogTheme());
+ builder = new AlertDialog.Builder(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
builder.setTitle("top scoring");
builder.setSingleChoiceItems(Constants.ThreadsSort.SORT_BY_TOP_CHOICES,
getSelectedSortByTop(), sortByTopOnClickListener);
@@ -1248,7 +1252,7 @@ public void onLoginChosen(String user, String password) {
// "Please wait"
case Constants.DIALOG_LOGGING_IN:
- pdialog = new ProgressDialog(this, mSettings.getDialogTheme());
+ pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
pdialog.setMessage("Logging in...");
pdialog.setIndeterminate(true);
pdialog.setCancelable(false);
@@ -52,6 +52,7 @@
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
+import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@@ -1050,7 +1051,7 @@ public void onLoginChosen(String user, String password) {
case Constants.DIALOG_COMPOSE:
inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- builder = new AlertDialog.Builder(this, mSettings.getDialogTheme());
+ builder = new AlertDialog.Builder(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
layout = inflater.inflate(R.layout.compose_dialog, null);
final EditText composeDestination = (EditText) layout.findViewById(R.id.compose_destination_input);
final EditText composeSubject = (EditText) layout.findViewById(R.id.compose_subject_input);
@@ -1102,21 +1103,21 @@ public void onClick(View v) {
// "Please wait"
case Constants.DIALOG_LOGGING_IN:
- pdialog = new ProgressDialog(this, mSettings.getDialogTheme());
+ pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
pdialog.setMessage("Logging in...");
pdialog.setIndeterminate(true);
pdialog.setCancelable(false);
dialog = pdialog;
break;
case Constants.DIALOG_REPLYING:
- pdialog = new ProgressDialog(this, mSettings.getDialogTheme());
+ pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
pdialog.setMessage("Sending reply...");
pdialog.setIndeterminate(true);
pdialog.setCancelable(false);
dialog = pdialog;
break;
case Constants.DIALOG_COMPOSING:
- pdialog = new ProgressDialog(this, mSettings.getDialogTheme());
+ pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
pdialog.setMessage("Composing message...");
pdialog.setIndeterminate(true);
pdialog.setCancelable(false);

0 comments on commit ee1e2f0

Please sign in to comment.