diff --git a/k9mail/src/main/java/com/fsck/k9/activity/compose/PgpEnabledErrorDialog.java b/k9mail/src/main/java/com/fsck/k9/activity/compose/PgpEnabledErrorDialog.java index 6324c1c63..b6b420002 100644 --- a/k9mail/src/main/java/com/fsck/k9/activity/compose/PgpEnabledErrorDialog.java +++ b/k9mail/src/main/java/com/fsck/k9/activity/compose/PgpEnabledErrorDialog.java @@ -42,33 +42,25 @@ public class PgpEnabledErrorDialog extends HighlightDialogFragment { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setView(view); - if (isGotItDialog) { - builder.setNeutralButton(R.string.openpgp_enabled_error_gotit, new OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); + builder.setNegativeButton(isGotItDialog ? R.string.openpgp_enabled_error_gotit : + R.string.openpgp_enabled_error_back, new OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + dialog.dismiss(); + } + }); + builder.setPositiveButton(R.string.openpgp_enabled_error_disable, new OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + Activity activity = getActivity(); + if (activity == null) { + return; } - }); - } else { - builder.setNegativeButton(R.string.openpgp_enabled_error_back, new OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - } - }); - builder.setPositiveButton(R.string.openpgp_enabled_error_disable, new OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - Activity activity = getActivity(); - if (activity == null) { - return; - } - ((OnOpenPgpDisableListener) activity).onOpenPgpClickDisable(); - dialog.dismiss(); - } - }); - } + ((OnOpenPgpDisableListener) activity).onOpenPgpClickDisable(); + dialog.dismiss(); + } + }); return builder.create(); } diff --git a/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientMvpView.java b/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientMvpView.java index 8d2f01c31..5723a274d 100644 --- a/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientMvpView.java +++ b/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientMvpView.java @@ -418,13 +418,13 @@ public class RecipientMvpView implements OnFocusChangeListener, OnClickListener dialog.show(activity.getFragmentManager(), "openpgp_signonly"); } - public void showOpenPgpEnabledErrorDialog(boolean isGotItDialog) { - PgpEnabledErrorDialog dialog = PgpEnabledErrorDialog.newInstance(isGotItDialog, R.id.crypto_status); + public void showOpenPgpEnabledErrorDialog(final boolean isGotItDialog) { + PgpEnabledErrorDialog dialog = PgpEnabledErrorDialog.newInstance(isGotItDialog, R.id.crypto_status_anchor); dialog.show(activity.getFragmentManager(), "openpgp_error"); } public void showOpenPgpEncryptExplanationDialog() { - PgpEncryptDescriptionDialog dialog = PgpEncryptDescriptionDialog.newInstance(R.id.crypto_status); + PgpEncryptDescriptionDialog dialog = PgpEncryptDescriptionDialog.newInstance(R.id.crypto_status_anchor); dialog.show(activity.getFragmentManager(), "openpgp_description"); } diff --git a/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java b/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java index fb4c303c0..b8c3add4c 100644 --- a/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java +++ b/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java @@ -896,6 +896,7 @@ public class RecipientPresenter implements PermissionPingCallback { } if (enableEncryption) { if (!cachedCryptoStatus.canEncrypt()) { + onCryptoModeChanged(CryptoMode.CHOICE_ENABLED); recipientMvpView.showOpenPgpEnabledErrorDialog(true); } else if (cachedCryptoStatus.canEncryptAndIsMutual()) { onCryptoModeChanged(CryptoMode.NO_CHOICE); diff --git a/k9mail/src/main/res/layout/message_compose_recipients.xml b/k9mail/src/main/res/layout/message_compose_recipients.xml index e0569fe92..ff3df5b39 100644 --- a/k9mail/src/main/res/layout/message_compose_recipients.xml +++ b/k9mail/src/main/res/layout/message_compose_recipients.xml @@ -101,71 +101,80 @@ - + android:clipChildren="false" + android:id="@+id/crypto_status_anchor" + > - - - - - + - + - + - + + + + + + + + +