@SuppressLint("InflateParams") @Override public AlertDialog onCreateDialog(Bundle savedInstanceState) { View dialogView = LayoutInflater.from(getActivity()) .inflate(R.layout.dialog_message, null); TextView messageView = (TextView) dialogView.findViewById(R.id.message); messageView.setMovementMethod(LinkMovementMethod.getInstance()); messageView.setText(Html.fromHtml(getArguments().getString(ARG_MESSAGE))); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());//), R.style.AppTheme_AlertDialog); builder.setTitle(getArguments().getString(ARG_TITLE)) .setIcon(getArguments().getInt(ARG_ICON)) .setView(dialogView) .setPositiveButton(R.string.OK, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); return builder.create(); }
private void showErrorDialog(DialogInterface.OnClickListener onTryAgain) { if (errorDialog != null && errorDialog.isShowing()) { return; } progress.cancel(); errorDialog = new AlertDialog.Builder(mContext) .setMessage(R.string.feedback_sending_error) .setIcon(R.drawable.ic_error_outline) .setPositiveButton(R.string.try_again, onTryAgain) .setNegativeButton(R.string.ok, null) .create(); if (errorDialog.getWindow() != null) { errorDialog.getWindow().setBackgroundDrawableResource(R.drawable.rounded_corners_background); } errorDialog.show(); }
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { return new AlertDialog.Builder(getContext()) .setTitle(R.string.app_name) .setIcon(R.mipmap.ic_launcher) .setMessage(getResources().getText(R.string.about_text)) .setPositiveButton(android.R.string.ok, null) .create(); }
+ certInfo.replaceAll("<br/>", "\n") + "\n" + getContext().getString(R.string.storeSecurityException)) .setIcon(android.R.drawable.ic_dialog_alert) .setPositiveButton(android.R.string.yes, (dialog, whichButton) -> { try {
.setTitle(R.string.untrusted_connection_title) .setMessage(R.string.untrusted_connection_message) .setIcon(R.drawable.ic_warning) .setPositiveButton(R.string.untrusted_connection_action_trust, (dialogInterface, i) -> {
mBuilder = new AlertDialog.Builder(context) .setTitle(mDialogTitle) .setIcon(mDialogIcon) .setPositiveButton(mPositiveButtonText, this) .setNegativeButton(mNegativeButtonText, this);
private void showDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setIcon(getIcon()); builder.setTitle(getTitle()); builder.setMessage(Html.fromHtml(getMessage(), null, getCustomTagHandler())); switch (mMode) { case MODE_CHECK_VERSION: builder.setPositiveButton(getUpdateNowLabel(), listener); builder.setNeutralButton(getRemindMeLaterLabel(), listener); builder.setNegativeButton(getIgnoreThisVersionLabel(), listener); break; case MODE_ASK_FOR_RATE: builder.setPositiveButton(getAskForRatePositiveLabel(), listener); builder.setNegativeButton(getAskForRateNegativeLabel(), listener); break; default: return; } builder.setCancelable(isDialogCancelable()); AlertDialog dialog = builder.create(); if (activity != null && !activity.isFinishing()) { dialog.show(); } }
void unlockPDF() { final EditText input = new EditText(this); input.setPadding(19, 19, 19, 19); input.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD); new AlertDialog.Builder(this) .setTitle(R.string.password) .setView(input) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { PDF_PASSWORD = input.getText().toString(); if (uri != null) displayFromUri(uri); } }) .setIcon(R.drawable.lock_icon) .show(); }
void getMeta() { PdfDocument.Meta meta = pdfView.getDocumentMeta(); if (meta != null) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.meta) .setMessage("Title: " + meta.getTitle() + "\n" + "Author: " + meta.getAuthor() + "\n" + "Creation Date: " + meta.getCreationDate()) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }) .setIcon(R.drawable.alert_icon) .show(); } }
private void showErrorDialog(String message) { AlertDialog dialog = new AlertDialog.Builder(this) .setTitle(R.string.error) .setMessage(message) .setIcon(R.drawable.ic_error_outline) .setPositiveButton(R.string.ok, null) .create(); if (dialog.getWindow() != null) { dialog.getWindow().setBackgroundDrawableResource(R.drawable.rounded_corners_background); } dialog.show(); }
@Override public Builder setIcon(int iconId) { super.setIcon(iconId); return this; }
@Override public Builder setIcon(Drawable icon) { super.setIcon(icon); return this; }