diff options
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java index fac4cc91..86526040 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java @@ -23,6 +23,7 @@ import java.util.concurrent.RejectedExecutionException; import de.tzur.conversations.Settings; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; +import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Downloadable; import eu.siacs.conversations.entities.Message; @@ -82,22 +83,26 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { TextView mTimestamp = (TextView) view.findViewById(R.id.conversation_lastupdate); ImageView imagePreview = (ImageView) view.findViewById(R.id.conversation_lastimage); - if (Settings.SHOW_ONLINE_STATUS) { + if (Settings.SHOW_ONLINE_STATUS && conversation != null && conversation.getAccount().getStatus() == Account.State.ONLINE) { TextView status = (TextView) view.findViewById(R.id.status); String color = "#000000"; - switch (conversation.getContact().getMostAvailableStatus()) { - case Presences.ONLINE: - case Presences.CHAT: - color = "#259B23"; - break; - case Presences.AWAY: - case Presences.XA: - color = "#FF9800"; - break; - case Presences.DND: - color = "#E51C23"; - break; + if (conversation.getMode() == Conversation.MODE_SINGLE) { + switch (conversation.getContact().getMostAvailableStatus()) { + case Presences.ONLINE: + case Presences.CHAT: + color = "#259B23"; + break; + case Presences.AWAY: + case Presences.XA: + color = "#FF9800"; + break; + case Presences.DND: + color = "#E51C23"; + break; + } + } else if (conversation.getMode() == Conversation.MODE_MULTI && conversation.getMucOptions().online()) { + color = "#259B23"; } status.setBackgroundColor(Color.parseColor(color)); } |