show email address as name instead of '<no name>'

This commit is contained in:
Vincent Breitmoser
2018-03-31 00:12:48 +02:00
parent c7e393180c
commit 5032453dc2

View File

@@ -25,6 +25,7 @@ import android.database.MatrixCursor;
import android.database.MergeCursor; import android.database.MergeCursor;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.format.DateUtils; import android.text.format.DateUtils;
@@ -387,11 +388,15 @@ public class KeySectionedListAdapter extends SectionCursorAdapter<KeySectionedLi
{ // set name and stuff, common to both key types { // set name and stuff, common to both key types
String name = keyItem.getName(); String name = keyItem.getName();
String email = keyItem.getEmail(); String email = keyItem.getEmail();
if (name != null) { if (name == null) {
mMainUserId.setText(highlighter.highlight(name)); if (email != null) {
mMainUserId.setText(highlighter.highlight(email));
mMainUserIdRest.setVisibility(View.GONE);
} else { } else {
mMainUserId.setText(R.string.user_id_no_name); mMainUserId.setText(R.string.user_id_no_name);
} }
} else {
mMainUserId.setText(highlighter.highlight(name));
if (email != null) { if (email != null) {
mMainUserIdRest.setText(highlighter.highlight(email)); mMainUserIdRest.setText(highlighter.highlight(email));
mMainUserIdRest.setVisibility(View.VISIBLE); mMainUserIdRest.setVisibility(View.VISIBLE);
@@ -399,6 +404,7 @@ public class KeySectionedListAdapter extends SectionCursorAdapter<KeySectionedLi
mMainUserIdRest.setVisibility(View.GONE); mMainUserIdRest.setVisibility(View.GONE);
} }
} }
}
{ // set edit button and status, specific by key type. Note: order is important! { // set edit button and status, specific by key type. Note: order is important!
int textColor; int textColor;