experimental cert display

This commit is contained in:
Vincent Breitmoser 2014-03-11 00:14:38 +01:00
parent 7a8db90425
commit 3b38ffe55e
2 changed files with 8 additions and 4 deletions

View File

@ -39,6 +39,7 @@ import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.KeychainDatabase;
import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.ui.adapter.ViewKeyKeysAdapter;
import org.sufficientlysecure.keychain.ui.adapter.ViewKeyUserIdsAdapter;
@ -173,10 +174,10 @@ public class ViewKeyMainFragment extends Fragment implements
static final int KEYRING_INDEX_MASTER_KEY_ID = 1;
static final int KEYRING_INDEX_USER_ID = 2;
static final String[] USER_IDS_PROJECTION = new String[]{KeychainContract.UserIds._ID, KeychainContract.UserIds.USER_ID,
KeychainContract.UserIds.RANK,};
static final String[] USER_IDS_PROJECTION = new String[]{ KeychainContract.UserIds._ID, KeychainContract.UserIds.USER_ID,
KeychainContract.UserIds.RANK, "verified" };
// not the main user id
static final String USER_IDS_SELECTION = KeychainContract.UserIds.RANK + " > 0 ";
static final String USER_IDS_SELECTION = KeychainDatabase.Tables.USER_IDS + "." + KeychainContract.UserIds.RANK + " > 0 ";
static final String USER_IDS_SORT_ORDER = KeychainContract.UserIds.USER_ID + " COLLATE LOCALIZED ASC";
static final String[] KEYS_PROJECTION = new String[]{KeychainContract.Keys._ID, KeychainContract.Keys.KEY_ID,

View File

@ -32,6 +32,7 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter {
private LayoutInflater mInflater;
private int mIndexUserId;
private int mVerifiedId;
public ViewKeyUserIdsAdapter(Context context, Cursor c, int flags) {
super(context, c, flags);
@ -57,15 +58,17 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter {
private void initIndex(Cursor cursor) {
if (cursor != null) {
mIndexUserId = cursor.getColumnIndexOrThrow(UserIds.USER_ID);
mVerifiedId = cursor.getColumnIndexOrThrow("verified");
}
}
@Override
public void bindView(View view, Context context, Cursor cursor) {
String userIdStr = cursor.getString(mIndexUserId);
int verified = cursor.getInt(mVerifiedId);
TextView userId = (TextView) view.findViewById(R.id.userId);
userId.setText(userIdStr);
userId.setText(userIdStr + (verified > 0 ? " (ok)" : "(nope)"));
}
@Override