From dd426ca6de3b764f8c748486b15220b42504930e Mon Sep 17 00:00:00 2001 From: Sam Whited Date: Fri, 7 Nov 2014 09:09:28 -0500 Subject: Format contact names in MUC properly --- .../conversations/ui/adapter/MessageAdapter.java | 25 +++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src/main/java/eu/siacs/conversations/ui/adapter') diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java index ffd0b4e9c..17253cff9 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -149,7 +149,7 @@ public class MessageAdapter extends ArrayAdapter { info = contact.getDisplayName(); } else { if (message.getPresence() != null) { - info = message.getPresence().toString(); + info = message.getPresence().getResourcepart(); } else { info = message.getCounterpart().toString(); } @@ -246,8 +246,7 @@ public class MessageAdapter extends ArrayAdapter { } else { to = message.getCounterpart(); } - privateMarker = activity.getString( - R.string.private_message_to, to); + privateMarker = activity.getString(R.string.private_message_to, to); } SpannableString span = new SpannableString(privateMarker + " " + message.getBody()); @@ -436,7 +435,7 @@ public class MessageAdapter extends ArrayAdapter { viewHolder.contact_picture.setImageBitmap(activity.avatarService().get(item.getConversation().getAccount(), activity.getPixel(48))); } - if (viewHolder.contact_picture != null) { + if (viewHolder != null && viewHolder.contact_picture != null) { viewHolder.contact_picture .setOnClickListener(new OnClickListener() { @@ -501,14 +500,16 @@ public class MessageAdapter extends ArrayAdapter { } else { displayInfoMessage(viewHolder, R.string.install_openkeychain); - viewHolder.message_box - .setOnClickListener(new OnClickListener() { - - @Override - public void onClick(View v) { - activity.showInstallPgpDialog(); - } - }); + if (viewHolder != null) { + viewHolder.message_box + .setOnClickListener(new OnClickListener() { + + @Override + public void onClick(View v) { + activity.showInstallPgpDialog(); + } + }); + } } } else if (item.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED) { displayDecryptionFailed(viewHolder); -- cgit v1.2.3