diff options
author | mar-v-in <github@rvin.mooo.com> | 2014-07-02 00:34:21 +0200 |
---|---|---|
committer | mar-v-in <github@rvin.mooo.com> | 2014-07-02 00:34:21 +0200 |
commit | 93eae114eac566a9ed2da6275c147b66ca480305 (patch) | |
tree | fed3c5614807522dc7a5ddce9bea40c061444fee /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptAsymmetricFragment.java | |
parent | 35647734104471a6d35bc26a77682dd5531dd5e3 (diff) | |
download | open-keychain-93eae114eac566a9ed2da6275c147b66ca480305.tar.gz open-keychain-93eae114eac566a9ed2da6275c147b66ca480305.tar.bz2 open-keychain-93eae114eac566a9ed2da6275c147b66ca480305.zip |
Encrypt/Decrypt UI work
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptAsymmetricFragment.java')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptAsymmetricFragment.java | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptAsymmetricFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptAsymmetricFragment.java index 51963e963..be845f05e 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptAsymmetricFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptAsymmetricFragment.java @@ -59,12 +59,15 @@ public class EncryptAsymmetricFragment extends Fragment { // model private long mSecretKeyId = Constants.key.none; private long mEncryptionKeyIds[] = null; + private String mEncryptionUserIds[] = null; // Container Activity must implement this interface public interface OnAsymmetricKeySelection { public void onSigningKeySelected(long signingKeyId); public void onEncryptionKeysSelected(long[] encryptionKeyIds); + + public void onEncryptionUserSelected(String[] encryptionUserIds); } @Override @@ -91,6 +94,13 @@ public class EncryptAsymmetricFragment extends Fragment { updateView(); } + private void setEncryptionUserIds(String[] encryptionUserIds) { + mEncryptionUserIds = encryptionUserIds; + // update key selection in EncryptActivity + mKeySelectionListener.onEncryptionUserSelected(encryptionUserIds); + updateView(); + } + /** * Inflate the layout for this fragment */ @@ -159,12 +169,14 @@ public class EncryptAsymmetricFragment extends Fragment { if (preselectedEncryptionKeyIds != null) { Vector<Long> goodIds = new Vector<Long>(); - for (int i = 0; i < preselectedEncryptionKeyIds.length; ++i) { + Vector<String> goodUserIds = new Vector<String>(); + for (long preselectedId : preselectedEncryptionKeyIds) { try { - long id = providerHelper.getCachedPublicKeyRing( - KeyRings.buildUnifiedKeyRingsFindBySubkeyUri( - preselectedEncryptionKeyIds[i]) - ).getMasterKeyId(); + CachedPublicKeyRing ring = providerHelper.getCachedPublicKeyRing( + KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(preselectedId)); + long id = ring.getMasterKeyId(); + ring.getSplitPrimaryUserId(); + goodUserIds.add(ring.getPrimaryUserId()); goodIds.add(id); } catch (PgpGeneralException e) { Log.e(Constants.TAG, "key not found!", e); @@ -176,6 +188,7 @@ public class EncryptAsymmetricFragment extends Fragment { keyIds[i] = goodIds.get(i); } setEncryptionKeyIds(keyIds); + setEncryptionUserIds(goodUserIds.toArray(new String[goodUserIds.size()])); } } } @@ -249,6 +262,7 @@ public class EncryptAsymmetricFragment extends Fragment { Bundle bundle = data.getExtras(); setEncryptionKeyIds(bundle .getLongArray(SelectPublicKeyActivity.RESULT_EXTRA_MASTER_KEY_IDS)); + setEncryptionUserIds(bundle.getStringArray(SelectPublicKeyActivity.RESULT_EXTRA_USER_IDS)); } break; } |