ui: subkey view redesign
This commit is contained in:
@@ -121,35 +121,17 @@ public class ViewKeyKeysAdapter extends CursorAdapter {
|
|||||||
keyId.setText(keyIdStr);
|
keyId.setText(keyIdStr);
|
||||||
// may be set with additional "stripped" later on
|
// may be set with additional "stripped" later on
|
||||||
if (hasAnySecret && cursor.getInt(mIndexHasSecret) == 0) {
|
if (hasAnySecret && cursor.getInt(mIndexHasSecret) == 0) {
|
||||||
keyDetails.setText("(" + algorithmStr + ", " +
|
keyDetails.setText(algorithmStr + ", " +
|
||||||
context.getString(R.string.key_stripped) + ")");
|
context.getString(R.string.key_stripped));
|
||||||
} else {
|
} else {
|
||||||
keyDetails.setText("(" + algorithmStr + ")");
|
keyDetails.setText(algorithmStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursor.getInt(mIndexRank) == 0) {
|
// Set icons according to properties
|
||||||
masterKeyIcon.setVisibility(View.INVISIBLE);
|
masterKeyIcon.setVisibility(cursor.getInt(mIndexRank) == 0 ? View.VISIBLE : View.INVISIBLE);
|
||||||
} else {
|
certifyIcon.setVisibility(cursor.getInt(mIndexCanCertify) != 0 ? View.VISIBLE : View.GONE);
|
||||||
masterKeyIcon.setVisibility(View.VISIBLE);
|
encryptIcon.setVisibility(cursor.getInt(mIndexCanEncrypt) != 0 ? View.VISIBLE : View.GONE);
|
||||||
}
|
signIcon.setVisibility(cursor.getInt(mIndexCanSign) != 0 ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean valid = true;
|
boolean valid = true;
|
||||||
if (cursor.getInt(mIndexRevokedKey) > 0) {
|
if (cursor.getInt(mIndexRevokedKey) > 0) {
|
||||||
@@ -168,13 +150,13 @@ public class ViewKeyKeysAdapter extends CursorAdapter {
|
|||||||
Date expiryDate = new Date(cursor.getLong(mIndexExpiry) * 1000);
|
Date expiryDate = new Date(cursor.getLong(mIndexExpiry) * 1000);
|
||||||
|
|
||||||
valid = valid && expiryDate.after(new Date());
|
valid = valid && expiryDate.after(new Date());
|
||||||
keyExpiry.setText("(" +
|
keyExpiry.setText(
|
||||||
context.getString(R.string.label_expiry) + ": " +
|
context.getString(R.string.label_expiry) + ": " +
|
||||||
DateFormat.getDateFormat(context).format(expiryDate) + ")");
|
DateFormat.getDateFormat(context).format(expiryDate));
|
||||||
|
|
||||||
keyExpiry.setVisibility(View.VISIBLE);
|
|
||||||
} else {
|
} 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
|
// if key is expired or revoked, strike through text
|
||||||
|
|||||||
@@ -1,83 +1,101 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingLeft="8dip"
|
android:paddingRight="3dip"
|
||||||
android:paddingRight="3dip">
|
android:singleLine="true">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/ic_masterKey"
|
android:id="@+id/ic_masterKey"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:paddingRight="6dip"
|
android:src="@drawable/key_small"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_marginLeft="8dp" />
|
||||||
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" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:orientation="vertical"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_marginLeft="8dp"
|
||||||
android:paddingBottom="2dip"
|
android:layout_marginRight="8dp">
|
||||||
android:paddingTop="2dip"
|
|
||||||
android:id="@+id/linearLayout">
|
|
||||||
|
|
||||||
<ImageView
|
<LinearLayout
|
||||||
android:id="@+id/ic_revokedKey"
|
android:layout_width="fill_parent"
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:src="@drawable/revoked_key_small" />
|
android:orientation="horizontal"
|
||||||
|
android:paddingBottom="2dip"
|
||||||
|
android:paddingTop="2dip">
|
||||||
|
|
||||||
<ImageView
|
<TextView
|
||||||
android:id="@+id/ic_certifyKey"
|
android:id="@+id/keyId"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:src="@drawable/certify_small" />
|
android:text="@string/label_key_id"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
android:typeface="monospace"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/ic_encryptKey"
|
android:id="@+id/ic_certifyKey"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:src="@drawable/encrypted_small" />
|
android:src="@drawable/certify_small"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_gravity="center_vertical" />
|
||||||
|
|
||||||
|
<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" />
|
||||||
|
|
||||||
|
<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" />
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/ic_signKey"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:src="@drawable/signed_small" />
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
</LinearLayout>
|
||||||
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" />
|
|
||||||
|
|
||||||
<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" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user