From 90643968147770ee8c799ab35eed4498a804ba01 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Wed, 28 Jun 2017 15:18:10 +0200 Subject: [PATCH] fix special mode indicator --- .../activity/compose/ComposeCryptoStatus.java | 2 +- .../k9/activity/compose/RecipientMvpView.java | 24 ++++++++----------- .../res/layout/message_compose_recipients.xml | 10 +++++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/k9mail/src/main/java/com/fsck/k9/activity/compose/ComposeCryptoStatus.java b/k9mail/src/main/java/com/fsck/k9/activity/compose/ComposeCryptoStatus.java index c9c6a4596..f17ffdfce 100644 --- a/k9mail/src/main/java/com/fsck/k9/activity/compose/ComposeCryptoStatus.java +++ b/k9mail/src/main/java/com/fsck/k9/activity/compose/ComposeCryptoStatus.java @@ -114,7 +114,7 @@ public class ComposeCryptoStatus { return CryptoSpecialModeDisplayType.SIGN_ONLY; } - if (isEncryptionEnabled() && isPgpInlineModeEnabled()) { + if (canEncrypt() && isPgpInlineModeEnabled()) { return CryptoSpecialModeDisplayType.PGP_INLINE; } 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 594c125e8..e996d1615 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 @@ -29,10 +29,6 @@ import com.fsck.k9.view.ToolableViewAnimator; public class RecipientMvpView implements OnFocusChangeListener, OnClickListener { private static final int VIEW_INDEX_HIDDEN = -1; - private static final int VIEW_INDEX_CRYPTO_SPECIAL_PGP_INLINE = 0; - private static final int VIEW_INDEX_CRYPTO_SPECIAL_SIGN_ONLY = 1; - private static final int VIEW_INDEX_CRYPTO_SPECIAL_SIGN_ONLY_PGP_INLINE = 2; - private static final int VIEW_INDEX_BCC_EXPANDER_VISIBLE = 0; private static final int VIEW_INDEX_BCC_EXPANDER_HIDDEN = 1; @@ -51,7 +47,7 @@ public class RecipientMvpView implements OnFocusChangeListener, OnClickListener private final RecipientSelectView bccView; private final ToolableViewAnimator cryptoStatusView; private final ViewAnimator recipientExpanderContainer; - private final ViewAnimator cryptoSpecialModeIndicator; + private final ToolableViewAnimator cryptoSpecialModeIndicator; private RecipientPresenter presenter; @@ -68,7 +64,7 @@ public class RecipientMvpView implements OnFocusChangeListener, OnClickListener recipientExpanderContainer = (ViewAnimator) activity.findViewById(R.id.recipient_expander_container); cryptoStatusView = (ToolableViewAnimator) activity.findViewById(R.id.crypto_status); cryptoStatusView.setOnClickListener(this); - cryptoSpecialModeIndicator = (ViewAnimator) activity.findViewById(R.id.crypto_special_mode); + cryptoSpecialModeIndicator = (ToolableViewAnimator) activity.findViewById(R.id.crypto_special_mode); cryptoSpecialModeIndicator.setOnClickListener(this); toView.setOnFocusChangeListener(this); @@ -292,14 +288,14 @@ public class RecipientMvpView implements OnFocusChangeListener, OnClickListener } public void showCryptoSpecialMode(CryptoSpecialModeDisplayType cryptoSpecialModeDisplayType) { - boolean shouldBeHidden = cryptoSpecialModeDisplayType.childToDisplay == VIEW_INDEX_HIDDEN; + boolean shouldBeHidden = cryptoSpecialModeDisplayType.childIdToDisplay == VIEW_INDEX_HIDDEN; if (shouldBeHidden) { cryptoSpecialModeIndicator.setVisibility(View.GONE); return; } cryptoSpecialModeIndicator.setVisibility(View.VISIBLE); - cryptoSpecialModeIndicator.setDisplayedChild(cryptoSpecialModeDisplayType.childToDisplay); + cryptoSpecialModeIndicator.setDisplayedChildId(cryptoSpecialModeDisplayType.childIdToDisplay); activity.invalidateOptionsMenu(); } @@ -470,15 +466,15 @@ public class RecipientMvpView implements OnFocusChangeListener, OnClickListener public enum CryptoSpecialModeDisplayType { NONE(VIEW_INDEX_HIDDEN), - PGP_INLINE(VIEW_INDEX_CRYPTO_SPECIAL_PGP_INLINE), - SIGN_ONLY(VIEW_INDEX_CRYPTO_SPECIAL_SIGN_ONLY), - SIGN_ONLY_PGP_INLINE(VIEW_INDEX_CRYPTO_SPECIAL_SIGN_ONLY_PGP_INLINE); + PGP_INLINE(R.id.crypto_special_inline), + SIGN_ONLY(R.id.crypto_special_sign_only), + SIGN_ONLY_PGP_INLINE(R.id.crypto_special_sign_only_inline); - final int childToDisplay; + final int childIdToDisplay; - CryptoSpecialModeDisplayType(int childToDisplay) { - this.childToDisplay = childToDisplay; + CryptoSpecialModeDisplayType(int childIdToDisplay) { + this.childIdToDisplay = childIdToDisplay; } } } diff --git a/k9mail/src/main/res/layout/message_compose_recipients.xml b/k9mail/src/main/res/layout/message_compose_recipients.xml index 978ad56ca..e0569fe92 100644 --- a/k9mail/src/main/res/layout/message_compose_recipients.xml +++ b/k9mail/src/main/res/layout/message_compose_recipients.xml @@ -50,16 +50,17 @@ android:layout_gravity="center_vertical" android:id="@+id/crypto_special_mode" android:visibility="gone" - tools:visibility="gone" + tools:visibility="visible" android:inAnimation="@anim/fade_in" android:outAnimation="@anim/fade_out" - custom:previewInitialChild="2"> + custom:previewInitialChild="1"> @@ -69,13 +70,16 @@ android:layout_height="wrap_content" android:layout_gravity="center" android:layout_margin="8dp" + android:id="@+id/crypto_special_sign_only" android:src="@drawable/status_signature_verified_cutout" android:tint="?attr/openpgp_blue" /> + android:layout_height="wrap_content" + android:id="@+id/crypto_special_sign_only_inline" + >