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/entities | |
parent | 486cea8ab6e3b5653a378cf22617a189a6339ec9 (diff) |
grey out offline contacts in StartConversation
Diffstat (limited to 'src/main/java/de/pixart/messenger/entities')
3 files changed, 23 insertions, 7 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Bookmark.java b/src/main/java/de/pixart/messenger/entities/Bookmark.java index c2e31039b..29f7a3c26 100644 --- a/src/main/java/de/pixart/messenger/entities/Bookmark.java +++ b/src/main/java/de/pixart/messenger/entities/Bookmark.java @@ -72,6 +72,11 @@ public class Bookmark extends Element implements ListItem { } @Override + public int getOffline() { + return 0; + } + + @Override public Jid getJid() { return this.getAttributeAsJid("jid"); } @@ -82,7 +87,7 @@ public class Bookmark extends Element implements ListItem { for (Element element : getChildren()) { if (element.getName().equals("group") && element.getContent() != null) { String group = element.getContent(); - tags.add(new Tag(group, UIHelper.getColorForName(group))); + tags.add(new Tag(group, UIHelper.getColorForName(group), 0)); } } return tags; diff --git a/src/main/java/de/pixart/messenger/entities/Contact.java b/src/main/java/de/pixart/messenger/entities/Contact.java index 7da8d423e..38808a1d7 100644 --- a/src/main/java/de/pixart/messenger/entities/Contact.java +++ b/src/main/java/de/pixart/messenger/entities/Contact.java @@ -136,6 +136,11 @@ public class Contact implements ListItem, Blockable { } } + @Override + public int getOffline() { + return 0; + } + public String getProfilePhoto() { return this.photoUri; } @@ -148,14 +153,12 @@ public class Contact implements ListItem, Blockable { public List<Tag> getTags(Context context) { final ArrayList<Tag> tags = new ArrayList<>(); for (final String group : getGroups()) { - tags.add(new Tag(group, UIHelper.getColorForName(group))); + tags.add(new Tag(group, UIHelper.getColorForName(group), 0)); } Presence.Status status = getShownStatus(); - if (status != Presence.Status.OFFLINE) { - tags.add(UIHelper.getTagForStatus(context, status)); - } + tags.add(UIHelper.getTagForStatus(context, status)); if (isBlocked()) { - tags.add(new Tag("blocked", 0xff2e2f3b)); + tags.add(new Tag("blocked", 0xff2e2f3b, 0)); } return tags; } diff --git a/src/main/java/de/pixart/messenger/entities/ListItem.java b/src/main/java/de/pixart/messenger/entities/ListItem.java index 7fbd37200..3b27c1baa 100644 --- a/src/main/java/de/pixart/messenger/entities/ListItem.java +++ b/src/main/java/de/pixart/messenger/entities/ListItem.java @@ -11,6 +11,8 @@ public interface ListItem extends Comparable<ListItem> { String getDisplayJid(); + int getOffline(); + Jid getJid(); List<Tag> getTags(Context context); @@ -18,10 +20,12 @@ public interface ListItem extends Comparable<ListItem> { final class Tag { private final String name; private final int color; + private final int offline; - public Tag(final String name, final int color) { + public Tag(final String name, final int color, final int offline) { this.name = name; this.color = color; + this.offline = offline; } public int getColor() { @@ -31,6 +35,10 @@ public interface ListItem extends Comparable<ListItem> { public String getName() { return this.name; } + + public int getOffline() { + return this.offline; + } } boolean match(Context context, final String needle); |