From f192c701794716d3b780b635342cf0f2e8b18ef5 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Sat, 15 Mar 2014 19:58:17 +0100 Subject: [PATCH] certs: green dots for verified status \o/ --- .../keychain/ui/adapter/ViewKeyUserIdsAdapter.java | 12 ++++++++++-- .../src/main/res/layout/view_key_userids_item.xml | 12 +++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyUserIdsAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyUserIdsAdapter.java index 980c401da..4ae6131c9 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyUserIdsAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyUserIdsAdapter.java @@ -25,6 +25,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.CheckBox; import android.widget.CompoundButton; +import android.widget.ImageView; import android.widget.TextView; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.pgp.PgpKeyHelper; @@ -90,18 +91,25 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter { TextView vRank = (TextView) view.findViewById(R.id.rank); TextView vUserId = (TextView) view.findViewById(R.id.userId); TextView vAddress = (TextView) view.findViewById(R.id.address); + ImageView vVerified = (ImageView) view.findViewById(R.id.certified); vRank.setText(Integer.toString(cursor.getInt(mIndexRank))); String[] userId = PgpKeyHelper.splitUserId(cursor.getString(mIndexUserId)); - int verified = cursor.getInt(mVerifiedId); if (userId[0] != null) { - vUserId.setText(userId[0] + (verified > 0 ? " (ok)" : "(nope)")); + vUserId.setText(userId[0]); } else { vUserId.setText(R.string.user_id_no_name); } vAddress.setText(userId[1]); + int verified = cursor.getInt(mVerifiedId); + // TODO introduce own resource for this :) + if(verified > 0) + vVerified.setImageResource(android.R.drawable.presence_online); + else + vVerified.setImageResource(android.R.drawable.presence_invisible); + // don't care further if checkboxes aren't shown if(mCheckStates == null) return; diff --git a/OpenPGP-Keychain/src/main/res/layout/view_key_userids_item.xml b/OpenPGP-Keychain/src/main/res/layout/view_key_userids_item.xml index 2e8cfeb04..aa14e6d2f 100644 --- a/OpenPGP-Keychain/src/main/res/layout/view_key_userids_item.xml +++ b/OpenPGP-Keychain/src/main/res/layout/view_key_userids_item.xml @@ -24,7 +24,8 @@ + android:layout_height="wrap_content" + android:layout_weight="1"> + + +