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 5ab22eadd..6b8eda1e8 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
@@ -24,7 +24,6 @@ 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.KeychainContract.UserIds;
import org.sufficientlysecure.keychain.util.Log;
import se.emilsjolander.stickylistheaders.StickyListHeadersAdapter;
@@ -37,6 +36,7 @@ import android.support.v4.widget.CursorAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.RelativeLayout;
import android.widget.TextView;
/**
@@ -91,29 +91,43 @@ public class KeyListPublicAdapter extends CursorAdapter implements StickyListHea
TextView mainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest);
TextView revoked = (TextView) view.findViewById(R.id.revoked);
- mainUserId.setText(R.string.user_id_no_name);
- mainUserIdRest.setText("");
- revoked.setVisibility(View.GONE);
-
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]);
+ 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);
}
boolean isRevoked = cursor.getInt(mIndexIsRevoked) > 0;
if (isRevoked) {
revoked.setVisibility(View.VISIBLE);
+ } else {
+ revoked.setVisibility(View.GONE);
}
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
- return mInflater.inflate(R.layout.key_list_item, null);
+ return mInflater.inflate(R.layout.key_list_public_item, null);
}
/**
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 ce9b48bff..34e2104c6 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
@@ -88,7 +88,7 @@ public class KeyListSecretAdapter extends CursorAdapter {
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
- return mInflater.inflate(R.layout.key_list_item, null);
+ return mInflater.inflate(R.layout.key_list_secret_item, null);
}
/** -------------------------- MULTI-SELECTION METHODS -------------- */
diff --git a/OpenPGP-Keychain/src/main/res/layout/api_apps_adapter_list_item.xml b/OpenPGP-Keychain/src/main/res/layout/api_apps_adapter_list_item.xml
index cb20a20af..c89540291 100644
--- a/OpenPGP-Keychain/src/main/res/layout/api_apps_adapter_list_item.xml
+++ b/OpenPGP-Keychain/src/main/res/layout/api_apps_adapter_list_item.xml
@@ -1,14 +1,13 @@
+ android:layout_height="wrap_content"
+ android:paddingTop="4dp"
+ android:paddingBottom="4dp">
\ No newline at end of file
diff --git a/OpenPGP-Keychain/src/main/res/layout/key_list_secret_activity.xml b/OpenPGP-Keychain/src/main/res/layout/key_list_secret_activity.xml
index 13370f2e5..cd208a545 100644
--- a/OpenPGP-Keychain/src/main/res/layout/key_list_secret_activity.xml
+++ b/OpenPGP-Keychain/src/main/res/layout/key_list_secret_activity.xml
@@ -2,17 +2,21 @@
+ android:layout_height="match_parent">
+ android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:paddingBottom="16dp"
+ android:paddingLeft="16dp"
+ android:paddingRight="16dp"
+ android:scrollbarStyle="outsideOverlay" />
diff --git a/OpenPGP-Keychain/src/main/res/layout/key_list_item.xml b/OpenPGP-Keychain/src/main/res/layout/key_list_secret_item.xml
similarity index 73%
rename from OpenPGP-Keychain/src/main/res/layout/key_list_item.xml
rename to OpenPGP-Keychain/src/main/res/layout/key_list_secret_item.xml
index 650485d71..3c9ec6aee 100644
--- a/OpenPGP-Keychain/src/main/res/layout/key_list_item.xml
+++ b/OpenPGP-Keychain/src/main/res/layout/key_list_secret_item.xml
@@ -4,6 +4,8 @@
android:layout_height="?android:attr/listPreferredItemHeight"
android:layout_marginRight="?android:attr/scrollbarSize"
android:paddingLeft="8dp"
+ android:paddingTop="4dp"
+ android:paddingBottom="4dp"
android:singleLine="true">
-
-
\ No newline at end of file