From 75659ddc1216ca9fa76826a641a22f5167fc1f9b Mon Sep 17 00:00:00 2001 From: steckbrief Date: Tue, 29 Mar 2016 23:09:43 +0200 Subject: Fixes FS#172: Conversations list not updated on status changes --- .../ui/adapter/ConversationAdapter.java | 29 +++++++--------------- 1 file changed, 9 insertions(+), 20 deletions(-) (limited to 'src/main/java/de') diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java index 37b8aa18..53e1462f 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java @@ -68,28 +68,17 @@ public class ConversationAdapter extends ArrayAdapter { ImageView imagePreview = (ImageView) view.findViewById(R.id.conversation_lastimage); ImageView notificationStatus = (ImageView) view.findViewById(R.id.notification_status); - if (Settings.SHOW_ONLINE_STATUS && conversation.getAccount().getStatus() == Account.State.ONLINE) { - TextView status = (TextView) view.findViewById(R.id.status); - - String color = "#000000"; - if (conversation.getMode() == Conversation.MODE_SINGLE) { - switch (conversation.getContact().getMostAvailableStatus()) { - case ONLINE: - case CHAT: - color = "#259B23"; - break; - case AWAY: - case XA: - color = "#FF9800"; - break; - case DND: - color = "#E51C23"; - break; + if (Settings.SHOW_ONLINE_STATUS) { + int color = ConversationsPlusColors.offline(); + if (conversation.getAccount().getStatus() == Account.State.ONLINE) { + if (conversation.getMode() == Conversation.MODE_SINGLE) { + color = UIHelper.getStatusColor(conversation.getContact().getMostAvailableStatus()); + } else if (conversation.getMode() == Conversation.MODE_MULTI && conversation.getMucOptions().online()) { + color = ConversationsPlusColors.online(); } - } else if (conversation.getMode() == Conversation.MODE_MULTI && conversation.getMucOptions().online()) { - color = "#259B23"; } - status.setBackgroundColor(Color.parseColor(color)); + TextView status = (TextView) view.findViewById(R.id.status); + status.setBackgroundColor(color); } Message message = conversation.getLatestMessage(); -- cgit v1.2.3