aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/entities/Bookmark.java
diff options
context:
space:
mode:
authorlookshe <github@lookshe.org>2016-03-06 19:42:55 +0100
committerlookshe <github@lookshe.org>2016-03-06 19:42:55 +0100
commit3c400703e082a1b180b35d891b8fb3460c7d5b87 (patch)
tree28738dd90fc41b4ab71897f38d324828778ad2e3 /src/main/java/de/thedevstack/conversationsplus/entities/Bookmark.java
parent72114d732427266024cdd6e27cd8d1aa60afae2f (diff)
parentf28d77dc42f6bac5a026e0b1c78562dee8de45ac (diff)
Merge branch 'trz/rebase' into trz/rename
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/entities/Bookmark.java')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/entities/Bookmark.java31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/Bookmark.java b/src/main/java/de/thedevstack/conversationsplus/entities/Bookmark.java
index 9e67bf2d..07a77eae 100644
--- a/src/main/java/de/thedevstack/conversationsplus/entities/Bookmark.java
+++ b/src/main/java/de/thedevstack/conversationsplus/entities/Bookmark.java
@@ -2,12 +2,11 @@ package de.thedevstack.conversationsplus.entities;
import android.graphics.Color;
-import android.graphics.Color;
-
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
+import de.thedevstack.conversationsplus.Config;
import de.thedevstack.conversationsplus.utils.UIHelper;
import de.thedevstack.conversationsplus.xml.Element;
import de.thedevstack.conversationsplus.xmpp.jid.Jid;
@@ -54,14 +53,26 @@ public class Bookmark extends Element implements ListItem {
if (this.mJoinedConversation != null
&& (this.mJoinedConversation.getMucOptions().getSubject() != null)) {
return this.mJoinedConversation.getMucOptions().getSubject();
- } else if (getName() != null) {
- return getName();
+ } else if (getBookmarkName() != null) {
+ return getBookmarkName();
} else {
return this.getJid().getLocalpart();
}
}
@Override
+ public String getDisplayJid() {
+ Jid jid = getJid();
+ if (Config.LOCK_DOMAINS_IN_CONVERSATIONS && jid != null && jid.getDomainpart().equals(Config.CONFERENCE_DOMAIN_LOCK)) {
+ return jid.getLocalpart();
+ } else if (jid != null) {
+ return jid.toString();
+ } else {
+ return null;
+ }
+ }
+
+ @Override
public Jid getJid() {
return this.getAttributeAsJid("jid");
}
@@ -143,12 +154,18 @@ public class Bookmark extends Element implements ListItem {
this.mJoinedConversation = conversation;
}
- public String getName() {
+ public String getBookmarkName() {
return this.getAttribute("name");
}
- public void setName(String name) {
- this.name = name;
+ public boolean setBookmarkName(String name) {
+ String before = getBookmarkName();
+ if (name != null && !name.equals(before)) {
+ this.setAttribute("name", name);
+ return true;
+ } else {
+ return false;
+ }
}
public void unregisterConversation() {