diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-11-09 18:24:01 +0100 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-11-09 18:24:01 +0100 |
commit | eb9e9883611f5f5c0c2bd7466e434794ab074c22 (patch) | |
tree | 8feb354f80e6c6159a12a608886ef5943f9312ce /src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java | |
parent | 69ef17efc054c9f3b7b3b5a26f419e6b920ffd13 (diff) |
fixed muc sender history for some cases (where the previous nick was a valid jid)
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java | 16 |
1 files changed, 12 insertions, 4 deletions
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 cefe42a77..16239ec82 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -135,10 +135,8 @@ public class MessageAdapter extends ArrayAdapter<Message> { Contact contact = message.getContact(); if (contact != null) { info = contact.getDisplayName(); - } else if (message.getCounterpart() != null) { - info = message.getCounterpart().getResourcepart(); } else { - info = ""; + info = getDisplayedMucCounterpart(message.getCounterpart()); } } break; @@ -303,6 +301,16 @@ public class MessageAdapter extends ArrayAdapter<Message> { viewHolder.image.setOnLongClickListener(openContextMenu); } + private String getDisplayedMucCounterpart(final Jid counterpart) { + if (counterpart==null) { + return ""; + } else if (!counterpart.getResourcepart().isEmpty()) { + return counterpart.getResourcepart(); + } else { + return counterpart.toString(); + } + } + @Override public View getView(int position, View view, ViewGroup parent) { final Message item = getItem(position); @@ -411,7 +419,7 @@ public class MessageAdapter extends ArrayAdapter<Message> { if (contact != null) { viewHolder.contact_picture.setImageBitmap(activity.avatarService().get(contact, activity.getPixel(48))); } else if (item.getConversation().getMode() == Conversation.MODE_MULTI) { - viewHolder.contact_picture.setImageBitmap(activity.avatarService().get(item.getCounterpart().getResourcepart(), + viewHolder.contact_picture.setImageBitmap(activity.avatarService().get(getDisplayedMucCounterpart(item.getCounterpart()), activity.getPixel(48))); } } else if (type == SENT) { |