show jids from address book in Start Conversation screen if only one account is used
This commit is contained in:
parent
af724a6697
commit
2febbe1b8d
|
@ -156,6 +156,9 @@ public class Contact implements ListItem, Blockable {
|
||||||
if (isBlocked()) {
|
if (isBlocked()) {
|
||||||
tags.add(new Tag(context.getString(R.string.blocked), 0xff2e2f3b));
|
tags.add(new Tag(context.getString(R.string.blocked), 0xff2e2f3b));
|
||||||
}
|
}
|
||||||
|
if (showInPhoneBook()) {
|
||||||
|
tags.add(new Tag(context.getString(R.string.phone_book), 0xFF1E88E5));
|
||||||
|
}
|
||||||
return tags;
|
return tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,6 +339,10 @@ public class Contact implements ListItem, Blockable {
|
||||||
|| (this.getOption(Contact.Options.DIRTY_PUSH));
|
|| (this.getOption(Contact.Options.DIRTY_PUSH));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean showInPhoneBook() {
|
||||||
|
return systemAccount != null && !systemAccount.trim().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
public void parseSubscriptionFromElement(Element item) {
|
public void parseSubscriptionFromElement(Element item) {
|
||||||
String ask = item.getAttribute("ask");
|
String ask = item.getAttribute("ask");
|
||||||
String subscription = item.getAttribute("subscription");
|
String subscription = item.getAttribute("subscription");
|
||||||
|
|
|
@ -858,11 +858,13 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
||||||
|
|
||||||
protected void filterContacts(String needle) {
|
protected void filterContacts(String needle) {
|
||||||
this.contacts.clear();
|
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) {
|
if (account.getStatus() != Account.State.DISABLED) {
|
||||||
for (Contact contact : account.getRoster().getContacts()) {
|
for (Contact contact : account.getRoster().getContacts()) {
|
||||||
Presence.Status s = contact.getShownStatus();
|
Presence.Status s = contact.getShownStatus();
|
||||||
if (contact.showInRoster() && contact.match(this, needle)
|
if ((contact.showInRoster() || (singleAccountActive && contact.showInPhoneBook())) && contact.match(this, needle)
|
||||||
&& (!this.mHideOfflineContacts
|
&& (!this.mHideOfflineContacts
|
||||||
|| (needle != null && !needle.trim().isEmpty())
|
|| (needle != null && !needle.trim().isEmpty())
|
||||||
|| s.compareTo(Presence.Status.OFFLINE) < 0)) {
|
|| s.compareTo(Presence.Status.OFFLINE) < 0)) {
|
||||||
|
@ -875,6 +877,16 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
||||||
mContactsAdapter.notifyDataSetChanged();
|
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) {
|
protected void filterConferences(String needle) {
|
||||||
this.conferences.clear();
|
this.conferences.clear();
|
||||||
for (Account account : xmppConnectionService.getAccounts()) {
|
for (Account account : xmppConnectionService.getAccounts()) {
|
||||||
|
|
|
@ -724,4 +724,5 @@
|
||||||
<string name="providing_a_name_is_optional">Providing a name is optional</string>
|
<string name="providing_a_name_is_optional">Providing a name is optional</string>
|
||||||
<string name="create_dialog_group_chat_name">Group chat name</string>
|
<string name="create_dialog_group_chat_name">Group chat name</string>
|
||||||
<string name="conference_destroyed">This group chat has been destroyed</string>
|
<string name="conference_destroyed">This group chat has been destroyed</string>
|
||||||
|
<string name="phone_book">Address book</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue