mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-02-19 20:31:52 -05:00
More layout fixes
This commit is contained in:
parent
99ec57aeaa
commit
34ec841a0b
@ -90,16 +90,11 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> {
|
|||||||
View view = mInflater.inflate(R.layout.import_keys_list_entry, null);
|
View view = mInflater.inflate(R.layout.import_keys_list_entry, null);
|
||||||
|
|
||||||
TextView mainUserId = (TextView) view.findViewById(R.id.mainUserId);
|
TextView mainUserId = (TextView) view.findViewById(R.id.mainUserId);
|
||||||
mainUserId.setText(R.string.user_id_no_name);
|
|
||||||
TextView mainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest);
|
TextView mainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest);
|
||||||
mainUserIdRest.setText("");
|
|
||||||
TextView keyId = (TextView) view.findViewById(R.id.keyId);
|
TextView keyId = (TextView) view.findViewById(R.id.keyId);
|
||||||
keyId.setText(R.string.no_key);
|
|
||||||
TextView fingerprint = (TextView) view.findViewById(R.id.fingerprint);
|
TextView fingerprint = (TextView) view.findViewById(R.id.fingerprint);
|
||||||
TextView algorithm = (TextView) view.findViewById(R.id.algorithm);
|
TextView algorithm = (TextView) view.findViewById(R.id.algorithm);
|
||||||
algorithm.setText("");
|
|
||||||
TextView status = (TextView) view.findViewById(R.id.status);
|
TextView status = (TextView) view.findViewById(R.id.status);
|
||||||
status.setText("");
|
|
||||||
|
|
||||||
// main user id
|
// main user id
|
||||||
String userId = entry.userIds.get(0);
|
String userId = entry.userIds.get(0);
|
||||||
@ -113,6 +108,8 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> {
|
|||||||
mainUserId.setTextColor(Color.RED);
|
mainUserId.setTextColor(Color.RED);
|
||||||
}
|
}
|
||||||
mainUserId.setText(userIdSplit[0]);
|
mainUserId.setText(userIdSplit[0]);
|
||||||
|
} else {
|
||||||
|
mainUserId.setText(R.string.user_id_no_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// email
|
// email
|
||||||
@ -123,9 +120,13 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> {
|
|||||||
mainUserIdRest.setVisibility(View.GONE);
|
mainUserIdRest.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: need to set no key?
|
||||||
|
keyId.setText(R.string.no_key);
|
||||||
keyId.setText(entry.hexKeyId);
|
keyId.setText(entry.hexKeyId);
|
||||||
fingerprint.setText(mActivity.getString(R.string.fingerprint) + " " + entry.fingerPrint);
|
fingerprint.setText(mActivity.getString(R.string.fingerprint) + " " + entry.fingerPrint);
|
||||||
|
|
||||||
|
// TODO: no need to set algorithm empty...
|
||||||
|
algorithm.setText("");
|
||||||
algorithm.setText("" + entry.bitStrength + "/" + entry.algorithm);
|
algorithm.setText("" + entry.bitStrength + "/" + entry.algorithm);
|
||||||
|
|
||||||
if (entry.revoked) {
|
if (entry.revoked) {
|
||||||
|
@ -103,18 +103,8 @@ public class KeyListPublicAdapter extends CursorAdapter implements StickyListHea
|
|||||||
if (userIdSplit[1] != null) {
|
if (userIdSplit[1] != null) {
|
||||||
mainUserIdRest.setText(userIdSplit[1]);
|
mainUserIdRest.setText(userIdSplit[1]);
|
||||||
mainUserIdRest.setVisibility(View.VISIBLE);
|
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 {
|
} else {
|
||||||
mainUserIdRest.setVisibility(View.INVISIBLE);
|
mainUserIdRest.setVisibility(View.GONE);
|
||||||
// center main user id field
|
|
||||||
RelativeLayout.LayoutParams layoutParams =
|
|
||||||
(RelativeLayout.LayoutParams) mainUserId.getLayoutParams();
|
|
||||||
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
|
|
||||||
mainUserId.setLayoutParams(layoutParams);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isRevoked = cursor.getInt(mIndexIsRevoked) > 0;
|
boolean isRevoked = cursor.getInt(mIndexIsRevoked) > 0;
|
||||||
|
@ -71,18 +71,20 @@ public class KeyListSecretAdapter extends CursorAdapter {
|
|||||||
@Override
|
@Override
|
||||||
public void bindView(View view, Context context, Cursor cursor) {
|
public void bindView(View view, Context context, Cursor cursor) {
|
||||||
TextView mainUserId = (TextView) view.findViewById(R.id.mainUserId);
|
TextView mainUserId = (TextView) view.findViewById(R.id.mainUserId);
|
||||||
mainUserId.setText(R.string.user_id_no_name);
|
|
||||||
TextView mainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest);
|
TextView mainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest);
|
||||||
mainUserIdRest.setText("");
|
|
||||||
|
|
||||||
String userId = cursor.getString(mIndexUserId);
|
String userId = cursor.getString(mIndexUserId);
|
||||||
String[] userIdSplit = PgpKeyHelper.splitUserId(userId);
|
String[] userIdSplit = PgpKeyHelper.splitUserId(userId);
|
||||||
|
|
||||||
if (userIdSplit[0] != null) {
|
if (userIdSplit[0] != null) {
|
||||||
mainUserId.setText(userIdSplit[0]);
|
mainUserId.setText(userIdSplit[0]);
|
||||||
|
} else {
|
||||||
|
mainUserId.setText(R.string.user_id_no_name);
|
||||||
}
|
}
|
||||||
if (userIdSplit[1] != null) {
|
if (userIdSplit[1] != null) {
|
||||||
mainUserIdRest.setText(userIdSplit[1]);
|
mainUserIdRest.setText(userIdSplit[1]);
|
||||||
|
} else {
|
||||||
|
mainUserIdRest.setText("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,27 +96,31 @@ public class SelectKeyCursorAdapter extends CursorAdapter {
|
|||||||
boolean valid = cursor.getInt(mIndexProjectionValid) > 0;
|
boolean valid = cursor.getInt(mIndexProjectionValid) > 0;
|
||||||
|
|
||||||
TextView mainUserId = (TextView) view.findViewById(R.id.mainUserId);
|
TextView mainUserId = (TextView) view.findViewById(R.id.mainUserId);
|
||||||
mainUserId.setText(R.string.user_id_no_name);
|
|
||||||
TextView mainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest);
|
TextView mainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest);
|
||||||
mainUserIdRest.setText("");
|
|
||||||
TextView keyId = (TextView) view.findViewById(R.id.keyId);
|
TextView keyId = (TextView) view.findViewById(R.id.keyId);
|
||||||
keyId.setText(R.string.no_key);
|
|
||||||
TextView status = (TextView) view.findViewById(R.id.status);
|
TextView status = (TextView) view.findViewById(R.id.status);
|
||||||
status.setText(R.string.unknown_status);
|
|
||||||
|
|
||||||
String userId = cursor.getString(mIndexUserId);
|
String userId = cursor.getString(mIndexUserId);
|
||||||
String[] userIdSplit = PgpKeyHelper.splitUserId(userId);
|
String[] userIdSplit = PgpKeyHelper.splitUserId(userId);
|
||||||
|
|
||||||
if (userIdSplit[0] != null) {
|
if (userIdSplit[0] != null) {
|
||||||
mainUserId.setText(userIdSplit[0]);
|
mainUserId.setText(userIdSplit[0]);
|
||||||
|
} else {
|
||||||
|
mainUserId.setText(R.string.user_id_no_name);
|
||||||
}
|
}
|
||||||
if (userIdSplit[1] != null) {
|
if (userIdSplit[1] != null) {
|
||||||
mainUserIdRest.setText(userIdSplit[1]);
|
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);
|
long masterKeyId = cursor.getLong(mIndexMasterKeyId);
|
||||||
keyId.setText(PgpKeyHelper.convertKeyIdToHex(masterKeyId));
|
keyId.setText(PgpKeyHelper.convertKeyIdToHex(masterKeyId));
|
||||||
|
|
||||||
|
// TODO: needed to set unknown_status?
|
||||||
|
status.setText(R.string.unknown_status);
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (mKeyType == Id.type.public_key) {
|
if (mKeyType == Id.type.public_key) {
|
||||||
status.setText(R.string.can_encrypt);
|
status.setText(R.string.can_encrypt);
|
||||||
|
@ -76,38 +76,39 @@ public class ViewKeyKeysAdapter extends CursorAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bindView(View view, Context context, Cursor cursor) {
|
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 keyIdStr = "0x" + PgpKeyHelper.convertKeyIdToHex(cursor.getLong(mIndexKeyId));
|
||||||
String algorithmStr = PgpKeyHelper.getAlgorithmInfo(cursor.getInt(mIndexAlgorithm),
|
String algorithmStr = PgpKeyHelper.getAlgorithmInfo(cursor.getInt(mIndexAlgorithm),
|
||||||
cursor.getInt(mIndexKeySize));
|
cursor.getInt(mIndexKeySize));
|
||||||
|
|
||||||
TextView keyId = (TextView) view.findViewById(R.id.keyId);
|
|
||||||
keyId.setText(keyIdStr);
|
keyId.setText(keyIdStr);
|
||||||
|
|
||||||
TextView keyDetails = (TextView) view.findViewById(R.id.keyDetails);
|
|
||||||
keyDetails.setText("(" + algorithmStr + ")");
|
keyDetails.setText("(" + algorithmStr + ")");
|
||||||
|
|
||||||
ImageView masterKeyIcon = (ImageView) view.findViewById(R.id.ic_masterKey);
|
|
||||||
if (cursor.getInt(mIndexIsMasterKey) != 1) {
|
if (cursor.getInt(mIndexIsMasterKey) != 1) {
|
||||||
masterKeyIcon.setVisibility(View.INVISIBLE);
|
masterKeyIcon.setVisibility(View.INVISIBLE);
|
||||||
} else {
|
} else {
|
||||||
masterKeyIcon.setVisibility(View.VISIBLE);
|
masterKeyIcon.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageView certifyIcon = (ImageView) view.findViewById(R.id.ic_certifyKey);
|
|
||||||
if (cursor.getInt(mIndexCanCertify) != 1) {
|
if (cursor.getInt(mIndexCanCertify) != 1) {
|
||||||
certifyIcon.setVisibility(View.GONE);
|
certifyIcon.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
certifyIcon.setVisibility(View.VISIBLE);
|
certifyIcon.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageView encryptIcon = (ImageView) view.findViewById(R.id.ic_encryptKey);
|
|
||||||
if (cursor.getInt(mIndexCanEncrypt) != 1) {
|
if (cursor.getInt(mIndexCanEncrypt) != 1) {
|
||||||
encryptIcon.setVisibility(View.GONE);
|
encryptIcon.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
encryptIcon.setVisibility(View.VISIBLE);
|
encryptIcon.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageView signIcon = (ImageView) view.findViewById(R.id.ic_signKey);
|
|
||||||
if (cursor.getInt(mIndexCanSign) != 1) {
|
if (cursor.getInt(mIndexCanSign) != 1) {
|
||||||
signIcon.setVisibility(View.GONE);
|
signIcon.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -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>
|
@ -1,8 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginRight="?android:attr/scrollbarSize"
|
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||||
|
android:gravity="center_vertical"
|
||||||
android:paddingLeft="8dp"
|
android:paddingLeft="8dp"
|
||||||
android:paddingTop="4dp"
|
android:paddingTop="4dp"
|
||||||
android:paddingBottom="4dp"
|
android:paddingBottom="4dp"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user