diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-03-15 23:09:26 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-03-15 23:09:26 +0100 |
commit | 95c8a6d304ebd57a141d30b3ecad2dc5c03e00e8 (patch) | |
tree | 0c6067c265c52bed5ee444b4c289e8f69705b71e /src/main/java/de/pixart/messenger/ui/adapter | |
parent | 486cea8ab6e3b5653a378cf22617a189a6339ec9 (diff) |
grey out offline contacts in StartConversation
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui/adapter')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java | 20 |
1 files changed, 20 insertions, 0 deletions
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 1502b187d..4e8336181 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java @@ -28,8 +28,11 @@ import de.pixart.messenger.utils.UIHelper; public class ListItemAdapter extends ArrayAdapter<ListItem> { + private static final float INACTIVE_ALPHA = 0.4684f; + private static final float ACTIVE_ALPHA = 1.0f; protected XmppActivity activity; protected boolean showDynamicTags = false; + protected boolean offline = false; private View.OnClickListener onTagTvClick = new View.OnClickListener() { @Override public void onClick(View view) { @@ -63,6 +66,7 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> { FlowLayout tagLayout = (FlowLayout) view.findViewById(R.id.tags); List<ListItem.Tag> tags = item.getTags(activity); + if (tags.size() == 0 || !this.showDynamicTags) { tagLayout.setVisibility(View.GONE); } else { @@ -84,6 +88,22 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> { tvJid.setVisibility(View.GONE); } tvName.setText(item.getDisplayName()); + if (tags.size() != 0) { + for (ListItem.Tag tag : tags) { + offline = tag.getOffline() == 1; + } + } + if (offline) { + tvName.setAlpha(INACTIVE_ALPHA); + tvJid.setAlpha(INACTIVE_ALPHA); + picture.setAlpha(INACTIVE_ALPHA); + tagLayout.setAlpha(INACTIVE_ALPHA); + } else { + tvName.setAlpha(ACTIVE_ALPHA); + tvJid.setAlpha(ACTIVE_ALPHA); + picture.setAlpha(ACTIVE_ALPHA); + tagLayout.setAlpha(ACTIVE_ALPHA); + } loadAvatar(item, picture); return view; } |