diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2015-05-30 02:24:45 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2015-05-30 02:24:45 +0200 |
commit | 61a6346f896806c9e21fba5e43997b06853e4b2c (patch) | |
tree | e09462386866979a6516eba42f35b4a2ec2cacc5 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain | |
parent | 313b4ac7d34b7d958e9880d0d47e78f319e91140 (diff) | |
download | open-keychain-61a6346f896806c9e21fba5e43997b06853e4b2c.tar.gz open-keychain-61a6346f896806c9e21fba5e43997b06853e4b2c.tar.bz2 open-keychain-61a6346f896806c9e21fba5e43997b06853e4b2c.zip |
show status indicators in EncryptFragment
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptModeAsymmetricFragment.java | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptModeAsymmetricFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptModeAsymmetricFragment.java index 258a9b3dc..9c7e494d1 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptModeAsymmetricFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptModeAsymmetricFragment.java @@ -21,7 +21,9 @@ import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.ViewAnimator; +import com.tokenautocomplete.TokenCompleteTextView.TokenListener; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing; @@ -33,6 +35,7 @@ import org.sufficientlysecure.keychain.provider.ProviderHelper.NotFoundException import org.sufficientlysecure.keychain.ui.adapter.KeyAdapter.KeyItem; import org.sufficientlysecure.keychain.ui.widget.EncryptKeyCompletionView; import org.sufficientlysecure.keychain.ui.widget.KeySpinner; +import org.sufficientlysecure.keychain.ui.widget.KeySpinner.OnKeyChangedListener; import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Passphrase; @@ -72,10 +75,40 @@ public class EncryptModeAsymmetricFragment extends EncryptModeFragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.encrypt_asymmetric_fragment, container, false); + mSignKeySpinner = (KeySpinner) view.findViewById(R.id.sign); mEncryptKeyView = (EncryptKeyCompletionView) view.findViewById(R.id.recipient_list); mEncryptKeyView.setThreshold(1); // Start working from first character + final ViewAnimator vSignatureIcon = (ViewAnimator) view.findViewById(R.id.result_signature_icon); + mSignKeySpinner.setOnKeyChangedListener(new OnKeyChangedListener() { + @Override + public void onKeyChanged(long masterKeyId) { + int child = masterKeyId != Constants.key.none ? 1 : 0; + if (vSignatureIcon.getDisplayedChild() != child) { + vSignatureIcon.setDisplayedChild(child); + } + } + }); + + final ViewAnimator vEncryptionIcon = (ViewAnimator) view.findViewById(R.id.result_encryption_icon); + mEncryptKeyView.setTokenListener(new TokenListener() { + @Override + public void onTokenAdded(Object o) { + if (vEncryptionIcon.getDisplayedChild() != 1) { + vEncryptionIcon.setDisplayedChild(1); + } + } + + @Override + public void onTokenRemoved(Object o) { + int child = mEncryptKeyView.getObjects().isEmpty() ? 0 : 1; + if (vEncryptionIcon.getDisplayedChild() != child) { + vEncryptionIcon.setDisplayedChild(child); + } + } + }); + return view; } |