aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/pixart/messenger/entities/Contact.java7
-rw-r--r--src/main/java/de/pixart/messenger/ui/StartConversationActivity.java16
2 files changed, 21 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Contact.java b/src/main/java/de/pixart/messenger/entities/Contact.java
index 40bd69976..6d07c5901 100644
--- a/src/main/java/de/pixart/messenger/entities/Contact.java
+++ b/src/main/java/de/pixart/messenger/entities/Contact.java
@@ -159,6 +159,9 @@ public class Contact implements ListItem, Blockable {
if (isBlocked()) {
tags.add(new Tag(context.getString(R.string.blocked), 0xff2e2f3b, 0));
}
+ if (showInPhoneBook()) {
+ tags.add(new Tag(context.getString(R.string.phone_book), 0xFF1E88E5, 0));
+ }
return tags;
}
@@ -384,6 +387,10 @@ public class Contact implements ListItem, Blockable {
|| (this.getOption(Contact.Options.DIRTY_PUSH));
}
+ public boolean showInPhoneBook() {
+ return systemAccount != null && !systemAccount.trim().isEmpty();
+ }
+
public void parseSubscriptionFromElement(Element item) {
String ask = item.getAttribute("ask");
String subscription = item.getAttribute("subscription");
diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
index 4e02df3ea..663905b7d 100644
--- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
@@ -874,11 +874,13 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
protected void filterContacts(String needle) {
this.contacts.clear();
- for (Account account : xmppConnectionService.getAccounts()) {
+ final List<Account> accounts = xmppConnectionService.getAccounts();
+ final boolean singleAccountActive = isSingleAccountActive(accounts);
+ for (Account account : accounts) {
if (account.getStatus() != Account.State.DISABLED) {
for (Contact contact : account.getRoster().getContacts()) {
Presence.Status s = contact.getShownStatus();
- if (contact.showInRoster() && contact.match(this, needle)
+ if ((contact.showInRoster() || (singleAccountActive && contact.showInPhoneBook())) && contact.match(this, needle)
&& (!this.mHideOfflineContacts
|| (needle != null && !needle.trim().isEmpty())
|| s.compareTo(Presence.Status.OFFLINE) < 0)) {
@@ -891,6 +893,16 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
mContactsAdapter.notifyDataSetChanged();
}
+ private static boolean isSingleAccountActive(final List<Account> accounts) {
+ int i = 0;
+ for(Account account : accounts) {
+ if (account.getStatus() != Account.State.DISABLED) {
+ ++i;
+ }
+ }
+ return i == 1;
+ }
+
protected void filterConferences(String needle) {
this.conferences.clear();
for (Account account : xmppConnectionService.getAccounts()) {