aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/entities/Contact.java13
-rw-r--r--src/main/res/values/strings.xml1
2 files changed, 9 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Contact.java b/src/main/java/de/pixart/messenger/entities/Contact.java
index 1cd6a1a37..0bcabb9b1 100644
--- a/src/main/java/de/pixart/messenger/entities/Contact.java
+++ b/src/main/java/de/pixart/messenger/entities/Contact.java
@@ -13,10 +13,13 @@ import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import de.pixart.messenger.Config;
+import de.pixart.messenger.R;
import de.pixart.messenger.utils.JidHelper;
import de.pixart.messenger.utils.UIHelper;
import de.pixart.messenger.xml.Element;
@@ -148,13 +151,13 @@ public class Contact implements ListItem, Blockable {
@Override
public List<Tag> getTags(Context context) {
final ArrayList<Tag> tags = new ArrayList<>();
- for (final String group : getGroups()) {
+ for (final String group : getGroups(true)) {
tags.add(new Tag(group, UIHelper.getColorForName(group), 0));
}
Presence.Status status = getShownStatus();
tags.add(UIHelper.getTagForStatus(context, status));
if (isBlocked()) {
- tags.add(new Tag("blocked", 0xff2e2f3b, 0));
+ tags.add(new Tag(context.getString(R.string.blocked), 0xff2e2f3b, 0));
}
return tags;
}
@@ -288,8 +291,8 @@ public class Contact implements ListItem, Blockable {
this.systemAccount = account;
}
- private List<String> getGroups() {
- ArrayList<String> groups = new ArrayList<>();
+ private Collection<String> getGroups(final boolean unique) {
+ final Collection<String> groups = unique ? new HashSet<>() : new ArrayList<>();
for (int i = 0; i < this.groups.length(); ++i) {
try {
groups.add(this.groups.getString(i));
@@ -435,7 +438,7 @@ public class Contact implements ListItem, Blockable {
if (this.serverName != null) {
item.setAttribute("name", this.serverName);
}
- for (String group : getGroups()) {
+ for (String group : getGroups(false)) {
item.addChild("group").setContent(group);
}
return item;
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 3dc4cf095..27366987c 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -41,6 +41,7 @@
<string name="block_domain_text">Block all contacts from %s?</string>
<string name="unblock_domain_text">Unblock all contacts from %s?</string>
<string name="contact_blocked">Contact blocked</string>
+ <string name="blocked">Blocked</string>
<string name="remove_bookmark_text">Would you like to remove %s as a bookmark? The conversation associated with this bookmark will not be removed.</string>
<string name="register_account">Register new account on server</string>
<string name="change_password_on_server">Change password on server</string>