diff options
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ConversationFragment.java | 9 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java | 16 |
2 files changed, 17 insertions, 8 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index cb7988cb..5d133e87 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -280,10 +280,11 @@ public class ConversationFragment extends Fragment { if (message.getStatus() <= Message.STATUS_RECEIVED) { if (message.getConversation().getMode() == Conversation.MODE_MULTI) { if (message.getCounterpart() != null) { - highlightInConference(message.getCounterpart().getResourcepart()); - } else { - highlightInConference(message - .getContact().getDisplayName()); + if (!message.getCounterpart().getResourcepart().isEmpty()) { + highlightInConference(message.getCounterpart().getResourcepart()); + } else { + highlightInConference(message.getCounterpart().toString()); + } } } else { Contact contact = message.getConversation() 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 cefe42a7..16239ec8 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) { |