Change AlertDialog.Builder
to MaterialAlertDialogBuilder
This commit is contained in:
parent
eadc2b2b47
commit
9be72289c3
10 changed files with 31 additions and 31 deletions
|
@ -10,8 +10,6 @@ import java.util.Map;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.app.Dialog;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
|
@ -116,6 +114,7 @@ import com.fsck.k9.ui.compose.QuotedMessagePresenter;
|
|||
import com.fsck.k9.ui.compose.WrapUriTextWatcher;
|
||||
import com.fsck.k9.ui.helper.SizeFormatter;
|
||||
import com.fsck.k9.ui.messagelist.DefaultFolderProvider;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import org.openintents.openpgp.OpenPgpApiManager;
|
||||
import org.openintents.openpgp.util.OpenPgpApi;
|
||||
import timber.log.Timber;
|
||||
|
@ -1127,10 +1126,10 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
|
||||
@Override
|
||||
public Dialog onCreateDialog(int id) {
|
||||
final Builder builder;
|
||||
final MaterialAlertDialogBuilder builder;
|
||||
switch (id) {
|
||||
case DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE:
|
||||
builder = new AlertDialog.Builder(this)
|
||||
builder = new MaterialAlertDialogBuilder(this)
|
||||
.setTitle(R.string.save_or_discard_draft_message_dlg_title);
|
||||
if (draftMessageId == null) {
|
||||
builder
|
||||
|
@ -1163,7 +1162,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
})
|
||||
.create();
|
||||
case DIALOG_CONFIRM_DISCARD_ON_BACK:
|
||||
return new AlertDialog.Builder(this)
|
||||
return new MaterialAlertDialogBuilder(this)
|
||||
.setTitle(R.string.confirm_discard_draft_message_title)
|
||||
.setMessage(R.string.confirm_discard_draft_message)
|
||||
.setPositiveButton(com.fsck.k9.ui.base.R.string.cancel_action, new DialogInterface.OnClickListener() {
|
||||
|
@ -1186,7 +1185,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
case DIALOG_CHOOSE_IDENTITY:
|
||||
int dialogThemeResourceId = getThemeManager().getDialogThemeResourceId();
|
||||
Context context = new ContextThemeWrapper(this, dialogThemeResourceId);
|
||||
builder = new AlertDialog.Builder(context);
|
||||
builder = new MaterialAlertDialogBuilder(context);
|
||||
builder.setTitle(R.string.send_as);
|
||||
final IdentityAdapter adapter = new IdentityAdapter(context);
|
||||
builder.setAdapter(adapter, new DialogInterface.OnClickListener() {
|
||||
|
@ -1199,7 +1198,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
|
||||
return builder.create();
|
||||
case DIALOG_CONFIRM_DISCARD: {
|
||||
return new AlertDialog.Builder(this)
|
||||
return new MaterialAlertDialogBuilder(this)
|
||||
.setTitle(R.string.dialog_confirm_delete_title)
|
||||
.setMessage(R.string.dialog_confirm_delete_message)
|
||||
.setPositiveButton(R.string.dialog_confirm_delete_confirm_button,
|
||||
|
|
|
@ -3,17 +3,17 @@ package com.fsck.k9.activity.compose;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.IdRes;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.IdRes;
|
||||
import com.fsck.k9.ui.R;
|
||||
import com.fsck.k9.view.HighlightDialogFragment;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
|
||||
public class PgpEnabledErrorDialog extends HighlightDialogFragment {
|
||||
|
@ -39,7 +39,7 @@ public class PgpEnabledErrorDialog extends HighlightDialogFragment {
|
|||
@SuppressLint("InflateParams")
|
||||
View view = LayoutInflater.from(activity).inflate(R.layout.openpgp_enabled_error_dialog, null);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity());
|
||||
builder.setView(view);
|
||||
|
||||
builder.setNegativeButton(isGotItDialog ? R.string.openpgp_enabled_error_gotit :
|
||||
|
|
|
@ -3,17 +3,17 @@ package com.fsck.k9.activity.compose;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.IdRes;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.IdRes;
|
||||
import com.fsck.k9.ui.R;
|
||||
import com.fsck.k9.view.HighlightDialogFragment;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
|
||||
public class PgpEncryptDescriptionDialog extends HighlightDialogFragment {
|
||||
|
@ -34,7 +34,7 @@ public class PgpEncryptDescriptionDialog extends HighlightDialogFragment {
|
|||
@SuppressLint("InflateParams")
|
||||
View view = LayoutInflater.from(activity).inflate(R.layout.openpgp_encrypt_description_dialog, null);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity());
|
||||
builder.setView(view);
|
||||
|
||||
builder.setPositiveButton(R.string.openpgp_sign_only_ok, new OnClickListener() {
|
||||
|
|
|
@ -3,17 +3,17 @@ package com.fsck.k9.activity.compose;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.IdRes;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.IdRes;
|
||||
import com.fsck.k9.ui.R;
|
||||
import com.fsck.k9.view.HighlightDialogFragment;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
|
||||
public class PgpInlineDialog extends HighlightDialogFragment {
|
||||
|
@ -38,7 +38,7 @@ public class PgpInlineDialog extends HighlightDialogFragment {
|
|||
@SuppressLint("InflateParams")
|
||||
View view = LayoutInflater.from(activity).inflate(R.layout.openpgp_inline_dialog, null);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity());
|
||||
builder.setView(view);
|
||||
|
||||
if (getArguments().getInt(ARG_FIRST_TIME) != 0) {
|
||||
|
|
|
@ -3,17 +3,17 @@ package com.fsck.k9.activity.compose;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.IdRes;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.IdRes;
|
||||
import com.fsck.k9.ui.R;
|
||||
import com.fsck.k9.view.HighlightDialogFragment;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
|
||||
public class PgpSignOnlyDialog extends HighlightDialogFragment {
|
||||
|
@ -38,7 +38,7 @@ public class PgpSignOnlyDialog extends HighlightDialogFragment {
|
|||
@SuppressLint("InflateParams")
|
||||
View view = LayoutInflater.from(activity).inflate(R.layout.openpgp_sign_only_dialog, null);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity());
|
||||
builder.setView(view);
|
||||
|
||||
if (getArguments().getInt(ARG_FIRST_TIME) != 0) {
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
package com.fsck.k9.fragment;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnCancelListener;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import timber.log.Timber;
|
||||
|
||||
public class ConfirmationDialogFragment extends DialogFragment implements OnClickListener,
|
||||
|
@ -58,7 +59,7 @@ public class ConfirmationDialogFragment extends DialogFragment implements OnClic
|
|||
String confirmText = args.getString(ARG_CONFIRM_TEXT);
|
||||
String cancelText = args.getString(ARG_CANCEL_TEXT);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getActivity());
|
||||
builder.setTitle(title);
|
||||
builder.setMessage(message);
|
||||
if (confirmText != null && cancelText != null) {
|
||||
|
|
|
@ -6,9 +6,9 @@ import android.text.method.LinkMovementMethod
|
|||
import android.view.View
|
||||
import android.widget.CheckBox
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.preference.PreferenceDialogFragmentCompat
|
||||
import com.fsck.k9.ui.R
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.fsck.k9.ui.base.R as BaseR
|
||||
|
||||
class AutocryptPreferEncryptDialogFragment : PreferenceDialogFragmentCompat() {
|
||||
|
@ -30,7 +30,7 @@ class AutocryptPreferEncryptDialogFragment : PreferenceDialogFragmentCompat() {
|
|||
preferEncryptCheckbox.performClick()
|
||||
}
|
||||
|
||||
return AlertDialog.Builder(requireContext())
|
||||
return MaterialAlertDialogBuilder(requireContext())
|
||||
.setView(view)
|
||||
.setPositiveButton(BaseR.string.okay_action, ::onClick)
|
||||
.setNegativeButton(BaseR.string.cancel_action, ::onClick)
|
||||
|
|
|
@ -4,7 +4,6 @@ package com.fsck.k9.ui.settings.account;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
|
@ -30,6 +29,7 @@ import com.fsck.k9.Preferences;
|
|||
import com.fsck.k9.ui.R;
|
||||
import com.fsck.k9.ui.base.K9Activity;
|
||||
import com.fsck.k9.ui.base.ThemeType;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import org.openintents.openpgp.util.OpenPgpApi;
|
||||
import org.openintents.openpgp.util.OpenPgpProviderUtil;
|
||||
import timber.log.Timber;
|
||||
|
@ -163,7 +163,7 @@ public class OpenPgpAppSelectDialog extends K9Activity {
|
|||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getActivity());
|
||||
|
||||
builder.setTitle(R.string.account_settings_crypto_app_select_title);
|
||||
|
||||
|
@ -231,7 +231,7 @@ public class OpenPgpAppSelectDialog extends K9Activity {
|
|||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity());
|
||||
|
||||
builder.setTitle(R.string.dialog_openkeychain_info_title);
|
||||
builder.setView(LayoutInflater.from(getActivity()).inflate(
|
||||
|
|
|
@ -10,7 +10,6 @@ import android.widget.CheckedTextView
|
|||
import android.widget.SeekBar
|
||||
import android.widget.SeekBar.OnSeekBarChangeListener
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.widget.SwitchCompat
|
||||
import androidx.preference.PreferenceDialogFragmentCompat
|
||||
import com.fsck.k9.NotificationVibration
|
||||
|
@ -18,6 +17,7 @@ import com.fsck.k9.VibratePattern
|
|||
import com.fsck.k9.ui.R
|
||||
import com.fsck.k9.ui.base.bundle.getEnum
|
||||
import com.fsck.k9.ui.base.bundle.putEnum
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import org.koin.android.ext.android.inject
|
||||
import com.fsck.k9.ui.base.R as BaseR
|
||||
|
||||
|
@ -53,7 +53,7 @@ class VibrationDialogFragment : PreferenceDialogFragmentCompat() {
|
|||
vibrationTimes,
|
||||
)
|
||||
|
||||
return AlertDialog.Builder(context)
|
||||
return MaterialAlertDialogBuilder(context)
|
||||
.setAdapter(adapter, null)
|
||||
.setPositiveButton(BaseR.string.okay_action, ::onClick)
|
||||
.setNegativeButton(BaseR.string.cancel_action, ::onClick)
|
||||
|
|
|
@ -8,13 +8,13 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.widget.CheckBox
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.constraintlayout.widget.Group
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.core.view.isGone
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.fragment.app.Fragment
|
||||
import app.k9mail.feature.settings.importing.R
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.fsck.k9.ui.base.R as BaseR
|
||||
|
||||
class PasswordPromptDialogFragment : DialogFragment() {
|
||||
|
@ -46,7 +46,7 @@ class PasswordPromptDialogFragment : DialogFragment() {
|
|||
outgoingServerName,
|
||||
)
|
||||
|
||||
return AlertDialog.Builder(requireContext())
|
||||
return MaterialAlertDialogBuilder(requireContext())
|
||||
.setView(dialogView)
|
||||
.setPositiveButton(BaseR.string.okay_action) { _, _ -> deliverPasswordPromptResult() }
|
||||
.setNegativeButton(BaseR.string.cancel_action, null)
|
||||
|
|
Loading…
Reference in a new issue