diff options
Diffstat (limited to 'OpenKeychain')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyKeysAdapter.java | 44 | ||||
-rw-r--r-- | OpenKeychain/src/main/res/layout/view_key_keys_item.xml | 142 |
2 files changed, 93 insertions, 93 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyKeysAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyKeysAdapter.java index 9e26e559f..f4942a2a0 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyKeysAdapter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyKeysAdapter.java @@ -121,35 +121,17 @@ public class ViewKeyKeysAdapter extends CursorAdapter { keyId.setText(keyIdStr); // may be set with additional "stripped" later on if (hasAnySecret && cursor.getInt(mIndexHasSecret) == 0) { - keyDetails.setText("(" + algorithmStr + ", " + - context.getString(R.string.key_stripped) + ")"); + keyDetails.setText(algorithmStr + ", " + + context.getString(R.string.key_stripped)); } else { - keyDetails.setText("(" + algorithmStr + ")"); + keyDetails.setText(algorithmStr); } - if (cursor.getInt(mIndexRank) == 0) { - masterKeyIcon.setVisibility(View.INVISIBLE); - } else { - masterKeyIcon.setVisibility(View.VISIBLE); - } - - if (cursor.getInt(mIndexCanCertify) != 1) { - certifyIcon.setVisibility(View.GONE); - } else { - certifyIcon.setVisibility(View.VISIBLE); - } - - if (cursor.getInt(mIndexCanEncrypt) != 1) { - encryptIcon.setVisibility(View.GONE); - } else { - encryptIcon.setVisibility(View.VISIBLE); - } - - if (cursor.getInt(mIndexCanSign) != 1) { - signIcon.setVisibility(View.GONE); - } else { - signIcon.setVisibility(View.VISIBLE); - } + // Set icons according to properties + masterKeyIcon.setVisibility(cursor.getInt(mIndexRank) == 0 ? View.VISIBLE : View.INVISIBLE); + certifyIcon.setVisibility(cursor.getInt(mIndexCanCertify) != 0 ? View.VISIBLE : View.GONE); + encryptIcon.setVisibility(cursor.getInt(mIndexCanEncrypt) != 0 ? View.VISIBLE : View.GONE); + signIcon.setVisibility(cursor.getInt(mIndexCanSign) != 0 ? View.VISIBLE : View.GONE); boolean valid = true; if (cursor.getInt(mIndexRevokedKey) > 0) { @@ -168,13 +150,13 @@ public class ViewKeyKeysAdapter extends CursorAdapter { Date expiryDate = new Date(cursor.getLong(mIndexExpiry) * 1000); valid = valid && expiryDate.after(new Date()); - keyExpiry.setText("(" + + keyExpiry.setText( context.getString(R.string.label_expiry) + ": " + - DateFormat.getDateFormat(context).format(expiryDate) + ")"); - - keyExpiry.setVisibility(View.VISIBLE); + DateFormat.getDateFormat(context).format(expiryDate)); } else { - keyExpiry.setVisibility(View.GONE); + keyExpiry.setText( + context.getString(R.string.label_expiry) + ": " + + context.getString(R.string.none)); } // if key is expired or revoked, strike through text diff --git a/OpenKeychain/src/main/res/layout/view_key_keys_item.xml b/OpenKeychain/src/main/res/layout/view_key_keys_item.xml index 66cd4d7b5..13feaf2cc 100644 --- a/OpenKeychain/src/main/res/layout/view_key_keys_item.xml +++ b/OpenKeychain/src/main/res/layout/view_key_keys_item.xml @@ -1,83 +1,101 @@ <?xml version="1.0" encoding="utf-8"?> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout 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:orientation="horizontal" - android:paddingLeft="8dip" - android:paddingRight="3dip"> + android:paddingRight="3dip" + android:singleLine="true"> <ImageView android:id="@+id/ic_masterKey" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:paddingRight="6dip" - android:layout_alignParentLeft="true" - android:src="@drawable/key_small" /> - - <TextView - android:id="@+id/keyId" - android:layout_toRightOf="@+id/ic_masterKey" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingRight="2dip" - android:text="@string/label_key_id" - android:textAppearance="?android:attr/textAppearanceSmall" - android:typeface="monospace" /> + android:src="@drawable/key_small" + android:layout_marginLeft="8dp" /> <LinearLayout - android:layout_width="wrap_content" + android:orientation="vertical" + android:layout_width="fill_parent" android:layout_height="wrap_content" - android:orientation="horizontal" - android:layout_alignParentEnd="true" - android:paddingBottom="2dip" - android:paddingTop="2dip" - android:id="@+id/linearLayout"> + android:layout_gravity="center_vertical" + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp"> - <ImageView - android:id="@+id/ic_revokedKey" - android:layout_width="wrap_content" + <LinearLayout + android:layout_width="fill_parent" android:layout_height="wrap_content" - android:src="@drawable/revoked_key_small" /> + android:orientation="horizontal" + android:paddingBottom="2dip" + android:paddingTop="2dip"> - <ImageView - android:id="@+id/ic_certifyKey" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:src="@drawable/certify_small" /> + <TextView + android:id="@+id/keyId" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:text="@string/label_key_id" + android:textAppearance="?android:attr/textAppearanceMedium" + android:typeface="monospace" + android:layout_weight="1" /> - <ImageView - android:id="@+id/ic_encryptKey" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:src="@drawable/encrypted_small" /> + <ImageView + android:id="@+id/ic_certifyKey" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/certify_small" + android:layout_marginLeft="8dp" + android:layout_gravity="center_vertical" /> - <ImageView - android:id="@+id/ic_signKey" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:src="@drawable/signed_small" /> - </LinearLayout> + <ImageView + android:id="@+id/ic_encryptKey" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/encrypted_small" + android:layout_marginLeft="8dp" + android:layout_gravity="center_vertical" /> - <TextView - android:id="@+id/keyDetails" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingRight="5dip" - android:text="(RSA, 1024bit)" - android:textAppearance="?android:attr/textAppearanceSmall" - android:layout_below="@+id/ic_masterKey" - android:layout_toRightOf="@+id/ic_masterKey" /> + <ImageView + android:id="@+id/ic_signKey" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/signed_small" + android:layout_marginLeft="8dp" + android:layout_gravity="center_vertical" /> - <TextView - android:id="@+id/keyExpiry" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right" - android:text="@string/label_expiry" - android:textAppearance="?android:attr/textAppearanceSmall" - android:layout_alignTop="@+id/keyDetails" - android:layout_alignRight="@+id/linearLayout" - android:layout_alignEnd="@+id/linearLayout" /> + <ImageView + android:id="@+id/ic_revokedKey" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/revoked_key_small" + android:layout_marginLeft="8dp" + android:layout_gravity="center_vertical" /> + + </LinearLayout> + + <LinearLayout + android:orientation="horizontal" + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + + <TextView + android:id="@+id/keyDetails" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:paddingRight="5dip" + android:text="RSA, 1024bit" + android:textAppearance="?android:attr/textAppearanceSmall" + android:layout_weight="1" /> + + <TextView + android:id="@+id/keyExpiry" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Expiry: 4/7/2016" + android:textAppearance="?android:attr/textAppearanceSmall" + android:layout_gravity="right" /> + </LinearLayout> + + </LinearLayout> -</RelativeLayout> +</LinearLayout> |