List of usage examples for android.app Dialog setOnCancelListener
public void setOnCancelListener(@Nullable OnCancelListener listener)
From source file:com.near.chimerarevo.fragments.CommentsFragment.java
@SuppressLint("SetJavaScriptEnabled") private void loadDisqusOAuth() { if (getActivity().getSharedPreferences(Constants.PREFS_TAG, Context.MODE_PRIVATE) .getString(Constants.KEY_REFRESH_TOKEN, "").length() > 1) { RequestBody formBody = new FormEncodingBuilder().add("grant_type", "refresh_token") .add("client_id", Constants.DISQUS_API_KEY).add("client_secret", Constants.DISQUS_API_SECRET) .add("refresh_token", getActivity().getSharedPreferences(Constants.PREFS_TAG, Context.MODE_PRIVATE) .getString(Constants.KEY_REFRESH_TOKEN, "")) .build();//from ww w . jav a 2 s.c o m Request request = new Request.Builder().url(Constants.DISQUS_TOKEN_URL).post(formBody).tag(FRAGMENT_TAG) .build(); if (mDialog == null) mDialog = ProgressDialogUtils.getInstance(getActivity(), R.string.text_login); else mDialog = ProgressDialogUtils.modifyInstance(mDialog, R.string.text_login); mDialog.show(); OkHttpUtils.getInstance().newCall(request).enqueue(new PostAccessTokenCallback()); return; } final Dialog dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.webview_layout); dialog.setCancelable(true); dialog.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { isDialogOpen = false; mFab.show(); } }); dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface arg0) { isDialogOpen = false; mFab.show(); } }); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) CookieManager.getInstance().removeAllCookies(null); else { CookieSyncManager.createInstance(getActivity()); CookieManager.getInstance().removeAllCookie(); } WebView wv = (WebView) dialog.findViewById(R.id.webview); wv.getSettings().setJavaScriptEnabled(true); wv.getSettings().setSaveFormData(false); wv.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); dialog.findViewById(R.id.progressContainer).setVisibility(View.GONE); dialog.findViewById(R.id.webViewContainer).setVisibility(View.VISIBLE); } @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); dialog.findViewById(R.id.progressContainer).setVisibility(View.VISIBLE); dialog.findViewById(R.id.webViewContainer).setVisibility(View.GONE); } @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { boolean state = super.shouldOverrideUrlLoading(view, url); if (url.contains(Constants.SITE_URL)) { String code = url.split("code=")[1]; RequestBody formBody = new FormEncodingBuilder().add("grant_type", "authorization_code") .add("client_id", Constants.DISQUS_API_KEY) .add("client_secret", Constants.DISQUS_API_SECRET) .add("redirect_uri", Constants.SITE_URL).add("code", code).build(); Request request = new Request.Builder().url(Constants.DISQUS_TOKEN_URL).post(formBody) .tag(FRAGMENT_TAG).build(); if (mDialog == null) mDialog = ProgressDialogUtils.getInstance(getActivity(), R.string.text_login); else mDialog = ProgressDialogUtils.modifyInstance(mDialog, R.string.text_login); dialog.dismiss(); mDialog.show(); OkHttpUtils.getInstance().newCall(request).enqueue(new PostAccessTokenCallback()); } return state; } @Override public void onReceivedSslError(WebView view, @NonNull SslErrorHandler handler, SslError error) { handler.proceed(); } }); wv.loadUrl(URLUtils.getDisqusAuthUrl()); isDialogOpen = true; mFab.hide(); dialog.show(); }
From source file:pulseanddecibels.jp.yamatenki.activity.SplashActivity.java
private void displayUserLicenseAgreement() { final Dialog dialog = new Dialog(SplashActivity.this); // dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_license_agreement); dialog.setTitle(getString(R.string.text_license_agreement_title)); dialog.setCanceledOnTouchOutside(false); Drawable d = new ColorDrawable(ContextCompat.getColor(this, R.color.yama_brown)); dialog.getWindow().setBackgroundDrawable(d); dialog.show();/*from w w w. jav a 2 s. co m*/ licenseAgreementDialogOpen = true; dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { if (!agreeButtonPressed) { licenseAgreementDialogOpen = false; settings.setAgreedToLicense(false); if (!databaseTaskRunning) { finish(); } } } }); dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { licenseAgreementDialogOpen = false; settings.setAgreedToLicense(false); if (!databaseTaskRunning) { finish(); } } }); final Button agreeButton = (Button) dialog.findViewById(R.id.agree_button); agreeButton.setEnabled(false); agreeButton.setAlpha(.5f); agreeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { settings.setAgreedToLicense(true); agreeButtonPressed = true; dialog.dismiss(); if (!databaseTaskRunning) { startMainActivity(); } } }); final CheckBox agreementCheckbox = (CheckBox) dialog.findViewById(R.id.agreement_checkbox); agreementCheckbox.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { CheckBox checkbox = (CheckBox) v; if (checkbox.isChecked()) { agreeButton.setAlpha(1.0f); agreeButton.setEnabled(true); } else { agreeButton.setAlpha(.5f); agreeButton.setEnabled(false); } } }); TextView agreementLabel = (TextView) dialog.findViewById(R.id.agreement_label); agreementLabel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { agreementCheckbox.setChecked(!agreementCheckbox.isChecked()); if (agreementCheckbox.isChecked()) { agreeButton.setAlpha(1.0f); agreeButton.setEnabled(true); } else { agreeButton.setAlpha(.5f); agreeButton.setEnabled(false); } } }); }
From source file:de.mkrtchyan.recoverytools.RecoveryTools.java
public void showOverRecoveryInstructions() { final AlertDialog.Builder Instructions = new AlertDialog.Builder(mContext); Instructions.setTitle(R.string.info).setMessage(R.string.flash_over_recovery) .setPositiveButton(R.string.positive, new DialogInterface.OnClickListener() { @Override/*from w w w.j a v a2s.co m*/ public void onClick(DialogInterface dialog, int which) { try { mToolbox.reboot(Toolbox.REBOOT_RECOVERY); } catch (Exception e) { e.printStackTrace(); } } }).setNeutralButton(R.string.instructions, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Dialog d = new Dialog(mContext); d.setTitle(R.string.instructions); TextView tv = new TextView(mContext); tv.setTextSize(20); tv.setText(R.string.instruction); d.setContentView(tv); d.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { Instructions.show(); } }); d.show(); } }).show(); }
From source file:com.github.howeyc.slideshow.activities.SettingsActivity.java
/************************************************************************************ * needed because else the nested preference screen don't have a actionbar/toolbar * * see the fix and the given problem here: http://stackoverflow.com/a/27455363 * ************************************************************************************/ public void setUpNestedScreen(PreferenceScreen preferenceScreen) { final Dialog dialog = preferenceScreen.getDialog(); //ViewGroup list; Toolbar bar;//from ww w . j ava 2 s .co m if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { //list = (ViewGroup) dialog.findViewById(android.R.id.list); LinearLayout root = (LinearLayout) dialog.findViewById(android.R.id.list).getParent(); bar = (Toolbar) LayoutInflater.from(this).inflate(R.layout.settings_toolbar, root, false); root.addView(bar, 0); // insert at top } else { ViewGroup root = (ViewGroup) dialog.findViewById(android.R.id.content); ListView content = (ListView) root.getChildAt(0); //list = content; root.removeAllViews(); bar = (Toolbar) LayoutInflater.from(this).inflate(R.layout.settings_toolbar, root, false); int height; TypedValue tv = new TypedValue(); if (getTheme().resolveAttribute(R.attr.actionBarSize, tv, true)) { height = TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics()); } else { height = bar.getHeight(); } content.setPadding(0, height, 0, 0); root.addView(content); root.addView(bar); } //list.addView(detailsPrefScreenToAdd.getStatusViewGroup(), 1); //TODO bar.setTitle(preferenceScreen.getTitle()); dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialogI) { if (AppData.getLoginSuccessful()) { dialogI.dismiss(); } else { showNotConnectedDialog(dialog); } } }); bar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (AppData.getLoginSuccessful()) { dialog.dismiss(); } else { showNotConnectedDialog(dialog); } } }); }
From source file:com.sentaroh.android.Utilities.LogUtil.CommonLogFileListDialogFragment.java
private void confirmSendLog() { CommonLogUtil.flushLog(mContext, mGp); mThemeColorList = ThemeUtil.getThemeColorList(getActivity()); createTempLogFile();//from w ww .j a v a 2 s . c o m final Dialog dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.confirm_send_log_dlg); dialog.setCanceledOnTouchOutside(false); LinearLayout title_view = (LinearLayout) dialog.findViewById(R.id.confirm_send_log_dlg_title_view); title_view.setBackgroundColor(mThemeColorList.dialog_title_background_color); TextView title = (TextView) dialog.findViewById(R.id.confirm_send_log_dlg_title); title.setTextColor(mThemeColorList.text_color_dialog_title); TextView msg = (TextView) dialog.findViewById(R.id.confirm_send_log_dlg_msg); msg.setTextColor(mThemeColorList.text_color_info); msg.setBackgroundColor(mThemeColorList.dialog_msg_background_color); final Button btn_ok = (Button) dialog.findViewById(R.id.confirm_send_log_dlg_ok_btn); final Button btn_cancel = (Button) dialog.findViewById(R.id.confirm_send_log_dlg_cancel_btn); final Button btn_preview = (Button) dialog.findViewById(R.id.confirm_send_log_dlg_preview); CommonDialog.setDlgBoxSizeLimit(dialog, false); btn_preview.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(android.content.Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse("file://" + mGp.getLogDirName() + "temp_log.txt"), "text/plain"); startActivity(intent); } }); btn_ok.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { sendLogFileToDeveloper(mGp.getLogDirName() + "temp_log.txt"); dialog.dismiss(); } }); btn_cancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { dialog.dismiss(); } }); dialog.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { btn_cancel.performClick(); } }); dialog.show(); }
From source file:com.mitre.holdshort.MainActivity.java
private void showNotSupportedDialog(String airport) { final Dialog dialog = new Dialog(MainActivity.this); OnCancelListener notSupportedCancelListener = null; notSupportedCancelListener = new OnCancelListener() { @Override// w w w. ja va 2s. co m public void onCancel(DialogInterface dialog) { dialog.dismiss(); finish(); } }; OnClickListener noAirportClickListener = new OnClickListener() { @Override public void onClick(View v) { switch (v.getId()) { case R.id.exit: dialog.dismiss(); finish(); break; case R.id.contactMitre: Log.d(LOG_TAG, "TEST"); contactMITRE("RIPPLE App Support"); case R.id.uploadData: AlertLogger al = new AlertLogger("999", MainActivity.this); default: return; } } }; if (airport == null) { dialog.setOnCancelListener(notSupportedCancelListener); dialog.setContentView(R.layout.no_airport_found_dialog); dialog.setTitle("No Airport Found!"); dialog.getWindow().setLayout(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); Button exit = (Button) dialog.findViewById(R.id.exit); Button contact = (Button) dialog.findViewById(R.id.contactMitre); Button uploadData = (Button) dialog.findViewById(R.id.uploadData); contact.setOnClickListener(noAirportClickListener); exit.setOnClickListener(noAirportClickListener); uploadData.setOnClickListener(noAirportClickListener); dialog.show(); } else { dialog.setOnCancelListener(notSupportedCancelListener); dialog.setContentView(R.layout.airport_not_supported_dialog); dialog.setTitle("Airport " + (airport.split("_"))[0] + " Not Supported"); dialog.getWindow().setLayout(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); Button exit = (Button) dialog.findViewById(R.id.exit); Button contact = (Button) dialog.findViewById(R.id.contactMitre); contact.setOnClickListener(noAirportClickListener); exit.setOnClickListener(noAirportClickListener); dialog.show(); } }
From source file:net.evendanan.android.hagarfingerpainting.HagarFingerpaintingActivity.java
@Override protected Dialog onCreateDialog(int id) { switch (id) { case DIALOG_NEW_PAPER: final Dialog newPaper = new Dialog(this); newPaper.setTitle(R.string.new_paper_dialog_title); newPaper.setContentView(R.layout.new_paper_dialog); newPaper.setCancelable(true);/*w w w .jav a 2 s . c o m*/ final EditText painterName = (EditText) newPaper.findViewById(R.id.painter_name_input_text); Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/schoolbell.ttf"); painterName.setTypeface(tf); final Gallery colors = (Gallery) newPaper.findViewById(R.id.colors_list); colors.setAdapter(new PaperColorListAdapter(getApplicationContext())); colors.setOnItemSelectedListener(new OnItemSelectedListener() { private View mSelectedItem = null; @Override public void onItemSelected(AdapterView<?> adapter, View v, int position, long id) { if (mSelectedItem != null) mSelectedItem.setBackgroundDrawable(null); mSelectedItem = v; if (mSelectedItem != null) mSelectedItem.setBackgroundResource(R.drawable.selected_color_background); } @Override public void onNothingSelected(AdapterView<?> arg0) { if (mSelectedItem != null) mSelectedItem.setBackgroundDrawable(null); } }); colors.setSelection(2); View createButton = newPaper.findViewById(R.id.new_paper_create_button); createButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); Editor e = sp.edit(); final CharSequence painterNameFromUI = painterName.getText().toString(); final String newPainterName = TextUtils.isEmpty(painterNameFromUI) ? getString(R.string.settings_key_painter_name_default_value) : painterNameFromUI.toString(); e.putString(getString(R.string.settings_key_painter_name), newPainterName); e.commit(); PaperBackground paper = (PaperBackground) colors.getSelectedItem(); newPaper.dismiss(); createNewPaper(paper); } }); View cancelButton = newPaper.findViewById(R.id.new_paper_cancel_button); cancelButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { newPaper.dismiss(); if (!mPaperCreated) HagarFingerpaintingActivity.this.finish(); } }); newPaper.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { if (!mPaperCreated) HagarFingerpaintingActivity.this.finish(); } }); return newPaper; default: return super.onCreateDialog(id); } }
From source file:com.sentaroh.android.TaskAutomation.Config.ProfileMaintenanceActionProfile.java
final static private void editDataArrayListItem(final GlobalParameters mGlblParms, final String edit_data, final int pos) { final Dialog dialog = new Dialog(mGlblParms.context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); // dialog.getWindow().setSoftInputMode( // WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); dialog.setContentView(R.layout.data_array_item_edit_dlg); // final TextView dlg_msg = (TextView) dialog.findViewById(R.id.data_array_item_edit_dlg_msg); final TextView dlg_title = (TextView) dialog.findViewById(R.id.data_array_item_edit_dlg_title); dlg_title.setText("Edit data"); final EditText dlg_value = (EditText) dialog.findViewById(R.id.data_array_item_edit_dlg_value); final Button dlg_apply = (Button) dialog.findViewById(R.id.data_array_item_edit_dlg_apply); final Button dlg_cancel = (Button) dialog.findViewById(R.id.data_array_item_edit_dlg_cancel); // CommonDialog.setDlgBoxSizeCompact(dialog); dlg_value.setText(edit_data);/*from w w w . j av a 2 s . c o m*/ // CANCEL? dlg_cancel.setOnClickListener(new View.OnClickListener() { final public void onClick(View v) { mGlblParms.actionCompareDataAdapter.getItem(pos).while_edit = false; mGlblParms.actionCompareDataAdapter.notifyDataSetChanged(); dialog.dismiss(); } }); // Apply? dlg_apply.setOnClickListener(new View.OnClickListener() { final public void onClick(View v) { mGlblParms.actionCompareDataAdapter.getItem(pos).while_edit = false; mGlblParms.actionCompareDataAdapter.getItem(pos).data_value = dlg_value.getText().toString(); mGlblParms.actionCompareDataAdapter.notifyDataSetChanged(); dialog.dismiss(); } }); // Cancel? dialog.setOnCancelListener(new Dialog.OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { dlg_cancel.performClick(); } }); // dialog.setCancelable(false); dialog.show(); }
From source file:com.sentaroh.android.TaskAutomation.Config.ActivityMain.java
private void confirmSendLog() { mGlblParms.util.flushLog();/*from ww w . j a v a2 s . c o m*/ createTempLogFile(); final Dialog dialog = new Dialog(mContext); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.confirm_send_log_dlg); final Button btn_ok = (Button) dialog.findViewById(R.id.confirm_send_log_dlg_ok_btn); final Button btn_cancel = (Button) dialog.findViewById(R.id.confirm_send_log_dlg_cancel_btn); final Button btn_preview = (Button) dialog.findViewById(R.id.confirm_send_log_dlg_preview); CommonDialog.setDlgBoxSizeLimit(dialog, false); btn_preview.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(android.content.Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse("file://" + mEnvParms.settingLogMsgDir + "temp_log.txt"), "text/plain"); startActivity(intent); } }); btn_ok.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { mGlblParms.util.sendLogFileToDeveloper(mEnvParms.settingLogMsgDir + "temp_log.txt"); dialog.dismiss(); } }); btn_cancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { dialog.dismiss(); } }); dialog.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { btn_cancel.performClick(); } }); dialog.show(); }
From source file:com.andrewshu.android.reddit.comments.CommentsListActivity.java
@Override protected Dialog onCreateDialog(int id) { final Dialog dialog; ProgressDialog pdialog;// www. j a v a 2 s . c om AlertDialog.Builder builder; LayoutInflater inflater; switch (id) { case Constants.DIALOG_LOGIN: dialog = new LoginDialog(this, mSettings, false) { @Override public void onLoginChosen(String user, String password) { removeDialog(Constants.DIALOG_LOGIN); new MyLoginTask(user, password).execute(); } }; break; case Constants.DIALOG_COMMENT_CLICK: dialog = new CommentClickDialog(this, mSettings); break; case Constants.DIALOG_REPLY: { dialog = new Dialog(this, mSettings.getDialogTheme()); dialog.setContentView(R.layout.compose_reply_dialog); final EditText replyBody = (EditText) dialog.findViewById(R.id.body); final Button replySaveButton = (Button) dialog.findViewById(R.id.reply_save_button); final Button replyCancelButton = (Button) dialog.findViewById(R.id.reply_cancel_button); replySaveButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mReplyTargetName != null) { new CommentReplyTask(mReplyTargetName).execute(replyBody.getText().toString()); dialog.dismiss(); } else { Common.showErrorToast("Error replying. Please try again.", Toast.LENGTH_SHORT, CommentsListActivity.this); } } }); replyCancelButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mVoteTargetThing.setReplyDraft(replyBody.getText().toString()); dialog.cancel(); } }); dialog.setCancelable(false); // disallow the BACK key dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { replyBody.setText(""); } }); break; } case Constants.DIALOG_EDIT: { dialog = new Dialog(this, mSettings.getDialogTheme()); dialog.setContentView(R.layout.compose_reply_dialog); final EditText replyBody = (EditText) dialog.findViewById(R.id.body); final Button replySaveButton = (Button) dialog.findViewById(R.id.reply_save_button); final Button replyCancelButton = (Button) dialog.findViewById(R.id.reply_cancel_button); replyBody.setText(mEditTargetBody); replySaveButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (mReplyTargetName != null) { new EditTask(mReplyTargetName).execute(replyBody.getText().toString()); dialog.dismiss(); } else { Common.showErrorToast("Error editing. Please try again.", Toast.LENGTH_SHORT, CommentsListActivity.this); } } }); replyCancelButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { dialog.cancel(); } }); dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { replyBody.setText(""); } }); break; } case Constants.DIALOG_DELETE: 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) { removeDialog(Constants.DIALOG_DELETE); new DeleteTask(mDeleteTargetKind).execute(mReplyTargetName); } }).setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); dialog = builder.create(); break; case Constants.DIALOG_SORT_BY: 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++) { if (Constants.CommentsSort.SORT_BY_URL_CHOICES[i].equals(mSettings.getCommentsSortByUrl())) { selectedSortBy = i; break; } } builder.setSingleChoiceItems(Constants.CommentsSort.SORT_BY_CHOICES, selectedSortBy, sortByOnClickListener); dialog = builder.create(); break; case Constants.DIALOG_REPORT: 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) { removeDialog(Constants.DIALOG_REPORT); new ReportTask(mReportTargetName.toString()).execute(); } }).setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); dialog = builder.create(); break; // "Please wait" case Constants.DIALOG_DELETING: pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme())); pdialog.setMessage("Deleting..."); pdialog.setIndeterminate(true); pdialog.setCancelable(true); dialog = pdialog; break; case Constants.DIALOG_EDITING: pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme())); pdialog.setMessage("Submitting edit..."); pdialog.setIndeterminate(true); pdialog.setCancelable(true); dialog = pdialog; break; case Constants.DIALOG_LOGGING_IN: pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme())); pdialog.setMessage("Logging in..."); pdialog.setIndeterminate(true); pdialog.setCancelable(true); dialog = pdialog; break; case Constants.DIALOG_REPLYING: pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme())); pdialog.setMessage("Sending reply..."); pdialog.setIndeterminate(true); pdialog.setCancelable(true); dialog = pdialog; break; case Constants.DIALOG_FIND: inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View content = inflater.inflate(R.layout.dialog_find, null); 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(new ContextThemeWrapper(this, mSettings.getDialogTheme())); builder.setView(content); builder.setTitle(R.string.find).setPositiveButton(R.string.find, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String search_text = find_box.getText().toString().toLowerCase(); // findCommentText(search_text, wrap_box.isChecked(), false); findCommentText(search_text, true, false); } }).setNegativeButton("Cancel", null); dialog = builder.create(); break; default: throw new IllegalArgumentException("Unexpected dialog id " + id); } return dialog; }