aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-05-31 21:49:40 +0200
committerChristian Schneppe <christian@pix-art.de>2017-05-31 21:49:40 +0200
commitc741b33bc22fc87eb75dbc448898ebeba88dbe0c (patch)
treecb7935fba0e0b7c19550e1ceb93b02ea26442f95 /src/main/java/de/pixart/messenger/services/XmppConnectionService.java
parent21bf06c064554c406a6b769160c36a471da45e07 (diff)
add the 4 most frequently contacted contacts as app shortcuts
Diffstat (limited to 'src/main/java/de/pixart/messenger/services/XmppConnectionService.java')
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index 61a9d2318..27412e1ea 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -70,6 +70,7 @@ import java.util.ListIterator;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import de.duenndns.ssl.MemorizingTrustManager;
@@ -189,8 +190,9 @@ public class XmppConnectionService extends Service {
};
private FileBackend fileBackend = new FileBackend(this);
private MemorizingTrustManager mMemorizingTrustManager;
- private NotificationService mNotificationService = new NotificationService(
- this);
+ private NotificationService mNotificationService = new NotificationService(this);
+ private ShortcutService mShortcutService = new ShortcutService(this);
+ private AtomicBoolean mInitialAddressbookSyncCompleted = new AtomicBoolean(false);
private OnMessagePacketReceived mMessageParser = new MessageParser(this);
private OnPresencePacketReceived mPresenceParser = new PresenceParser(this);
private IqParser mIqParser = new IqParser(this);
@@ -1663,6 +1665,7 @@ public class XmppConnectionService extends Service {
}
}
Log.d(Config.LOGTAG, "finished merging phone contacts");
+ mShortcutService.refresh(mInitialAddressbookSyncCompleted.compareAndSet(false, true));
updateAccountUi();
}
});
@@ -3788,10 +3791,11 @@ public class XmppConnectionService extends Service {
return this.mMessageArchiveService;
}
- public List<Contact> findContacts(Jid jid) {
+ public List<Contact> findContacts(Jid jid, String accountJid) {
ArrayList<Contact> contacts = new ArrayList<>();
for (Account account : getAccounts()) {
- if (!account.isOptionSet(Account.OPTION_DISABLED)) {
+ if (!account.isOptionSet(Account.OPTION_DISABLED)
+ && (accountJid == null || accountJid.equals(account.getJid().toBareJid().toString()))) {
Contact contact = account.getRoster().getContactFromRoster(jid);
if (contact != null) {
contacts.add(contact);
@@ -4176,6 +4180,10 @@ public class XmppConnectionService extends Service {
}
}
+ public ShortcutService getShortcutService() {
+ return mShortcutService;
+ }
+
public interface OnMamPreferencesFetched {
void onPreferencesFetched(Element prefs);