diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-04-05 23:23:36 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-04-05 23:23:36 +0200 |
commit | 49bf040dae15b9d52245fe2313ff610ddc8448c3 (patch) | |
tree | 3b5a61e18a008778bb6cd022d89af6791a54c69c /OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain | |
parent | 8ce837dbe4d8a2e1e69d581a7c877719558209e0 (diff) | |
download | open-keychain-49bf040dae15b9d52245fe2313ff610ddc8448c3.tar.gz open-keychain-49bf040dae15b9d52245fe2313ff610ddc8448c3.tar.bz2 open-keychain-49bf040dae15b9d52245fe2313ff610ddc8448c3.zip |
Use PgpKeyHelper.splitUserId in EncryptAsymmetricFragment
Diffstat (limited to 'OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain')
-rw-r--r-- | OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptAsymmetricFragment.java | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptAsymmetricFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptAsymmetricFragment.java index 6e84211cc..8400cf397 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptAsymmetricFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptAsymmetricFragment.java @@ -190,21 +190,20 @@ public class EncryptAsymmetricFragment extends Fragment { mMainUserId.setText(""); mMainUserIdRest.setText(""); } else { - String uid = getResources().getString(R.string.user_id_no_name); - String uidExtra = ""; // See if we can get a user_id from a unified query - String user_id = (String) ProviderHelper.getUnifiedData( + String userIdResult = (String) ProviderHelper.getUnifiedData( getActivity(), mSecretKeyId, KeyRings.USER_ID, ProviderHelper.FIELD_TYPE_STRING); - if(user_id != null) { - String chunks[] = user_id.split(" <", 2); - uid = chunks[0]; - if (chunks.length > 1) { - uidExtra = "<" + chunks[1]; - } + String[] userId = PgpKeyHelper.splitUserId(userIdResult); + if (userId[0] != null) { + mMainUserId.setText(userId[0]); + } else { + mMainUserId.setText(getResources().getString(R.string.user_id_no_name)); + } + if (userId[1] != null) { + mMainUserIdRest.setText(userId[1]); + } else { + mMainUserIdRest.setText(""); } - - mMainUserId.setText(uid); - mMainUserIdRest.setText(uidExtra); mSign.setChecked(true); } } |