diff options
author | lookshe <github@lookshe.org> | 2015-04-11 21:49:48 +0200 |
---|---|---|
committer | lookshe <github@lookshe.org> | 2015-04-11 21:49:48 +0200 |
commit | 82bfd8ac335b84613677ff857cf27c455fdf512d (patch) | |
tree | 995bb0f078a15c4949e6222d6cfdab6f813bcf92 /src/main | |
parent | ae520c29573a5ae4b9129685ad9766f335ab6f26 (diff) |
show online status under avatar in same way for muc as the send button does
Diffstat (limited to 'src/main')
-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)); } |