Show pgp inline menu item only if encryption/signing is actually enabled

This commit is contained in:
Vincent Breitmoser 2017-09-26 21:25:58 +02:00
parent b63ed68838
commit d21639cca1

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);