Merge pull request #2795 from k9mail/hide-pgp-inline

Show pgp inline menu item only if encryption/signing is actually enabled
This commit is contained in:
cketti 2017-10-03 19:31:05 +02:00 committed by GitHub
commit 7ac6b5b0ef

View file

@ -273,10 +273,6 @@ public class RecipientPresenter implements PermissionPingCallback {
ComposeCryptoStatus currentCryptoStatus = getCurrentCachedCryptoStatus();
boolean isCryptoConfigured = currentCryptoStatus != null && currentCryptoStatus.isProviderStateOk();
if (isCryptoConfigured) {
boolean pgpInlineModeEnabled = currentCryptoStatus.isPgpInlineModeEnabled();
menu.findItem(R.id.openpgp_inline_enable).setVisible(!pgpInlineModeEnabled);
menu.findItem(R.id.openpgp_inline_disable).setVisible(pgpInlineModeEnabled);
boolean isEncrypting = currentCryptoStatus.isEncryptionEnabled();
menu.findItem(R.id.openpgp_encrypt_enable).setVisible(!isEncrypting);
menu.findItem(R.id.openpgp_encrypt_disable).setVisible(isEncrypting);
@ -285,6 +281,11 @@ public class RecipientPresenter implements PermissionPingCallback {
boolean isSignOnly = currentCryptoStatus.isSignOnly();
menu.findItem(R.id.openpgp_sign_only).setVisible(showSignOnly && !isSignOnly);
menu.findItem(R.id.openpgp_sign_only_disable).setVisible(showSignOnly && isSignOnly);
boolean pgpInlineModeEnabled = currentCryptoStatus.isPgpInlineModeEnabled();
boolean showPgpInlineEnable = (isEncrypting || isSignOnly) && !pgpInlineModeEnabled;
menu.findItem(R.id.openpgp_inline_enable).setVisible(showPgpInlineEnable);
menu.findItem(R.id.openpgp_inline_disable).setVisible(pgpInlineModeEnabled);
} else {
menu.findItem(R.id.openpgp_inline_enable).setVisible(false);
menu.findItem(R.id.openpgp_inline_disable).setVisible(false);