From 0f59e6bd950087d99a0909e55276e649639bb51b Mon Sep 17 00:00:00 2001 From: Tim Bray Date: Tue, 18 Nov 2014 22:12:50 -0800 Subject: In the ImportKeysList display, arrange for Keybase UserIDs to sort below the rest. Also mention Keybase stuff other than Twitter/GitHub/Website --- .../keychain/ui/ViewKeyTrustFragment.java | 5 +++-- .../keychain/ui/adapter/ImportKeysAdapter.java | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'OpenKeychain/src/main/java') diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyTrustFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyTrustFragment.java index 4965b2525..ef14299b1 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyTrustFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyTrustFragment.java @@ -268,14 +268,15 @@ public class ViewKeyTrustFragment extends LoaderFragment implements if (haveProofFor(proof.getType())) { ssb.append("\u00a0["); startAt = ssb.length(); - ssb.append("Verify"); + String verify = getString(R.string.keybase_verify); + ssb.append(verify); ClickableSpan clicker = new ClickableSpan() { @Override public void onClick(View view) { verify(proof, fingerprint); } }; - ssb.setSpan(clicker, startAt, startAt + "Verify".length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + ssb.setSpan(clicker, startAt, startAt + verify.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); ssb.append("]"); } return ssb; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java index 6c81e9193..f3dce5823 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java @@ -213,8 +213,24 @@ public class ImportKeysAdapter extends ArrayAdapter { // destroyLoader view from holder holder.userIdsList.removeAllViews(); + // we want conventional gpg UserIDs first, then Keybase ”proofs” HashMap> mergedUserIds = entry.getMergedUserIds(); - for (Map.Entry> pair : mergedUserIds.entrySet()) { + ArrayList>> sortedIds = new ArrayList>>(mergedUserIds.entrySet()); + java.util.Collections.sort(sortedIds, new java.util.Comparator>>() { + @Override + public int compare(Map.Entry> entry1, Map.Entry> entry2) { + + // sort keybase UserIds after non-Keybase + boolean e1IsKeybase = entry1.getKey().contains(":"); + boolean e2IsKeybase = entry2.getKey().contains(":"); + if (e1IsKeybase != e2IsKeybase) { + return (e1IsKeybase) ? 1 : -1; + } + return entry1.getKey().compareTo(entry2.getKey()); + } + }); + + for (Map.Entry> pair : sortedIds) { String cUserId = pair.getKey(); HashSet cEmails = pair.getValue(); -- cgit v1.2.3