diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-04-05 22:01:30 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-04-05 22:21:41 +0200 |
commit | ebefdd1873c924ffcefe6be3d3d72234de420eb0 (patch) | |
tree | bfd6ed45fcab1075db1a03f7f0a6d5cab3ce7cac /src/main/java/de/pixart/messenger/ui | |
parent | acc23261c687d7a66d772b3a92c69002e7001b94 (diff) |
Show colored presence status for contacts in overview and contact list
* online, free for chat = green
* away = yellow
* dnd, xa = red
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java | 22 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java | 5 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java index 476d3034d..f36aa6f39 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java @@ -7,6 +7,7 @@ import android.graphics.Typeface; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.AsyncTask; +import android.support.v4.content.ContextCompat; import android.util.Pair; import android.view.LayoutInflater; import android.view.View; @@ -180,6 +181,27 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { ImageView profilePicture = (ImageView) view.findViewById(R.id.conversation_image); loadAvatar(conversation, profilePicture); + if (conversation.getMode() == Conversation.MODE_SINGLE) { + switch (conversation.getContact().getPresences().getShownStatus()) { + case CHAT: + case ONLINE: + convName.setTextColor(ContextCompat.getColor(activity, R.color.online)); + break; + case AWAY: + convName.setTextColor(ContextCompat.getColor(activity, R.color.away)); + break; + case XA: + case DND: + convName.setTextColor(ContextCompat.getColor(activity, R.color.notavailable)); + break; + default: + convName.setTextColor(ContextCompat.getColor(activity, R.color.black87)); + break; + } + } else { + convName.setTextColor(ContextCompat.getColor(activity, R.color.black87)); + } + if (activity.xmppConnectionService.indicateReceived()) { switch (message.getMergedStatus()) { case Message.STATUS_SEND_RECEIVED: diff --git a/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java index 4e8336181..0f8dbfee9 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java @@ -8,6 +8,7 @@ import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.AsyncTask; import android.preference.PreferenceManager; +import android.support.v4.content.ContextCompat; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -32,6 +33,7 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> { private static final float ACTIVE_ALPHA = 1.0f; protected XmppActivity activity; protected boolean showDynamicTags = false; + protected int color = 0; protected boolean offline = false; private View.OnClickListener onTagTvClick = new View.OnClickListener() { @Override @@ -91,14 +93,17 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> { if (tags.size() != 0) { for (ListItem.Tag tag : tags) { offline = tag.getOffline() == 1; + color = tag.getColor(); } } if (offline) { + tvName.setTextColor(ContextCompat.getColor(activity, R.color.black87)); tvName.setAlpha(INACTIVE_ALPHA); tvJid.setAlpha(INACTIVE_ALPHA); picture.setAlpha(INACTIVE_ALPHA); tagLayout.setAlpha(INACTIVE_ALPHA); } else { + tvName.setTextColor(color); tvName.setAlpha(ACTIVE_ALPHA); tvJid.setAlpha(ACTIVE_ALPHA); picture.setAlpha(ACTIVE_ALPHA); |