diff options
7 files changed, 74 insertions, 30 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java index a282932dc..02a5fea9c 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java @@ -90,16 +90,11 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> { View view = mInflater.inflate(R.layout.import_keys_list_entry, null); TextView mainUserId = (TextView) view.findViewById(R.id.mainUserId); - mainUserId.setText(R.string.user_id_no_name); TextView mainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest); - mainUserIdRest.setText(""); TextView keyId = (TextView) view.findViewById(R.id.keyId); - keyId.setText(R.string.no_key); TextView fingerprint = (TextView) view.findViewById(R.id.fingerprint); TextView algorithm = (TextView) view.findViewById(R.id.algorithm); - algorithm.setText(""); TextView status = (TextView) view.findViewById(R.id.status); - status.setText(""); // main user id String userId = entry.userIds.get(0); @@ -113,6 +108,8 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> { mainUserId.setTextColor(Color.RED); } mainUserId.setText(userIdSplit[0]); + } else { + mainUserId.setText(R.string.user_id_no_name); } // email @@ -123,9 +120,13 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> { mainUserIdRest.setVisibility(View.GONE); } + // TODO: need to set no key? + keyId.setText(R.string.no_key); keyId.setText(entry.hexKeyId); fingerprint.setText(mActivity.getString(R.string.fingerprint) + " " + entry.fingerPrint); + // TODO: no need to set algorithm empty... + algorithm.setText(""); algorithm.setText("" + entry.bitStrength + "/" + entry.algorithm); if (entry.revoked) { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java index 6b8eda1e8..40cdb91ad 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java @@ -103,18 +103,8 @@ public class KeyListPublicAdapter extends CursorAdapter implements StickyListHea if (userIdSplit[1] != null) { mainUserIdRest.setText(userIdSplit[1]); mainUserIdRest.setVisibility(View.VISIBLE); - // disable centering of main user id field - RelativeLayout.LayoutParams layoutParams = - (RelativeLayout.LayoutParams) mainUserId.getLayoutParams(); - layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, 0); - mainUserId.setLayoutParams(layoutParams); } else { - mainUserIdRest.setVisibility(View.INVISIBLE); - // center main user id field - RelativeLayout.LayoutParams layoutParams = - (RelativeLayout.LayoutParams) mainUserId.getLayoutParams(); - layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT); - mainUserId.setLayoutParams(layoutParams); + mainUserIdRest.setVisibility(View.GONE); } boolean isRevoked = cursor.getInt(mIndexIsRevoked) > 0; diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListSecretAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListSecretAdapter.java index 34e2104c6..11d1e8c17 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListSecretAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListSecretAdapter.java @@ -71,18 +71,20 @@ public class KeyListSecretAdapter extends CursorAdapter { @Override public void bindView(View view, Context context, Cursor cursor) { TextView mainUserId = (TextView) view.findViewById(R.id.mainUserId); - mainUserId.setText(R.string.user_id_no_name); TextView mainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest); - mainUserIdRest.setText(""); String userId = cursor.getString(mIndexUserId); String[] userIdSplit = PgpKeyHelper.splitUserId(userId); if (userIdSplit[0] != null) { mainUserId.setText(userIdSplit[0]); + } else { + mainUserId.setText(R.string.user_id_no_name); } if (userIdSplit[1] != null) { mainUserIdRest.setText(userIdSplit[1]); + } else { + mainUserIdRest.setText(""); } } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java index 7e01faf9b..d44dd5890 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java @@ -96,27 +96,31 @@ public class SelectKeyCursorAdapter extends CursorAdapter { boolean valid = cursor.getInt(mIndexProjectionValid) > 0; TextView mainUserId = (TextView) view.findViewById(R.id.mainUserId); - mainUserId.setText(R.string.user_id_no_name); TextView mainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest); - mainUserIdRest.setText(""); TextView keyId = (TextView) view.findViewById(R.id.keyId); - keyId.setText(R.string.no_key); TextView status = (TextView) view.findViewById(R.id.status); - status.setText(R.string.unknown_status); String userId = cursor.getString(mIndexUserId); String[] userIdSplit = PgpKeyHelper.splitUserId(userId); if (userIdSplit[0] != null) { mainUserId.setText(userIdSplit[0]); + } else { + mainUserId.setText(R.string.user_id_no_name); } if (userIdSplit[1] != null) { mainUserIdRest.setText(userIdSplit[1]); + } else { + mainUserIdRest.setText(""); } + // TODO: needed to key id to no? + keyId.setText(R.string.no_key); long masterKeyId = cursor.getLong(mIndexMasterKeyId); keyId.setText(PgpKeyHelper.convertKeyIdToHex(masterKeyId)); + // TODO: needed to set unknown_status? + status.setText(R.string.unknown_status); if (valid) { if (mKeyType == Id.type.public_key) { status.setText(R.string.can_encrypt); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyKeysAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyKeysAdapter.java index d5162c403..54c7eb60e 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyKeysAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyKeysAdapter.java @@ -76,38 +76,39 @@ public class ViewKeyKeysAdapter extends CursorAdapter { @Override public void bindView(View view, Context context, Cursor cursor) { + TextView keyId = (TextView) view.findViewById(R.id.keyId); + TextView keyDetails = (TextView) view.findViewById(R.id.keyDetails); + ImageView masterKeyIcon = (ImageView) view.findViewById(R.id.ic_masterKey); + ImageView certifyIcon = (ImageView) view.findViewById(R.id.ic_certifyKey); + ImageView encryptIcon = (ImageView) view.findViewById(R.id.ic_encryptKey); + ImageView signIcon = (ImageView) view.findViewById(R.id.ic_signKey); + String keyIdStr = "0x" + PgpKeyHelper.convertKeyIdToHex(cursor.getLong(mIndexKeyId)); String algorithmStr = PgpKeyHelper.getAlgorithmInfo(cursor.getInt(mIndexAlgorithm), cursor.getInt(mIndexKeySize)); - TextView keyId = (TextView) view.findViewById(R.id.keyId); keyId.setText(keyIdStr); - TextView keyDetails = (TextView) view.findViewById(R.id.keyDetails); keyDetails.setText("(" + algorithmStr + ")"); - ImageView masterKeyIcon = (ImageView) view.findViewById(R.id.ic_masterKey); if (cursor.getInt(mIndexIsMasterKey) != 1) { masterKeyIcon.setVisibility(View.INVISIBLE); } else { masterKeyIcon.setVisibility(View.VISIBLE); } - ImageView certifyIcon = (ImageView) view.findViewById(R.id.ic_certifyKey); if (cursor.getInt(mIndexCanCertify) != 1) { certifyIcon.setVisibility(View.GONE); } else { certifyIcon.setVisibility(View.VISIBLE); } - ImageView encryptIcon = (ImageView) view.findViewById(R.id.ic_encryptKey); if (cursor.getInt(mIndexCanEncrypt) != 1) { encryptIcon.setVisibility(View.GONE); } else { encryptIcon.setVisibility(View.VISIBLE); } - ImageView signIcon = (ImageView) view.findViewById(R.id.ic_signKey); if (cursor.getInt(mIndexCanSign) != 1) { signIcon.setVisibility(View.GONE); } else { diff --git a/OpenPGP-Keychain/src/main/res/layout/key_list_public_item.xml b/OpenPGP-Keychain/src/main/res/layout/key_list_public_item.xml new file mode 100644 index 000000000..9307ab2e5 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/layout/key_list_public_item.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:minHeight="?android:attr/listPreferredItemHeight" + android:layout_marginRight="?android:attr/scrollbarSize" + android:gravity="center_vertical" + android:paddingLeft="8dp" + android:paddingRight="8dp" + android:paddingTop="4dp" + android:paddingBottom="4dp" + android:singleLine="true"> + + <TextView + android:id="@+id/mainUserId" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Main User ID" + android:textAppearance="?android:attr/textAppearanceMedium" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" /> + + <TextView + android:id="@+id/mainUserIdRest" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="<user@example.com>" + android:textAppearance="?android:attr/textAppearanceSmall" + android:layout_below="@+id/mainUserId" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" /> + + <TextView + android:id="@+id/revoked" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textAppearance="?android:attr/textAppearanceSmall" + android:text="@string/revoked" + android:textColor="#e00" + android:visibility="gone" + android:layout_alignParentTop="true" + android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" /> + +</RelativeLayout>
\ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/layout/key_list_secret_item.xml b/OpenPGP-Keychain/src/main/res/layout/key_list_secret_item.xml index 3c9ec6aee..1ed86f730 100644 --- a/OpenPGP-Keychain/src/main/res/layout/key_list_secret_item.xml +++ b/OpenPGP-Keychain/src/main/res/layout/key_list_secret_item.xml @@ -1,8 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layout_height="?android:attr/listPreferredItemHeight" - android:layout_marginRight="?android:attr/scrollbarSize" + android:layout_height="wrap_content" + android:minHeight="?android:attr/listPreferredItemHeight" + android:gravity="center_vertical" android:paddingLeft="8dp" android:paddingTop="4dp" android:paddingBottom="4dp" |