diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-03-14 20:56:50 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-03-14 20:56:50 +0100 |
commit | 9f86aadbb290c6733aed07ee701e30265dd08ce4 (patch) | |
tree | 4fab7137460ec8fec98f015e37407c5ab3bc746b /src/main/java/de | |
parent | e15c8b73161faf9bd2acb2a548fb0e77a10f218e (diff) |
update shortcutbadger async
Diffstat (limited to 'src/main/java/de')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 4ea6b5f35..cd40442cd 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -49,7 +49,11 @@ import org.openintents.openpgp.util.OpenPgpServiceConnection; import java.io.FileDescriptor; import java.io.FileNotFoundException; +import java.io.IOException; import java.math.BigInteger; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.SocketAddress; import java.net.URL; import java.security.SecureRandom; import java.security.cert.CertificateException; @@ -120,6 +124,7 @@ import de.pixart.messenger.utils.PhoneHelper; import de.pixart.messenger.utils.ReplacingSerialSingleThreadExecutor; import de.pixart.messenger.utils.SerialSingleThreadExecutor; import de.pixart.messenger.utils.Namespace; +import de.pixart.messenger.utils.SocksSocketFactory; import de.pixart.messenger.utils.XmppUri; import de.pixart.messenger.xml.Element; import de.pixart.messenger.xmpp.OnBindListener; @@ -3534,16 +3539,22 @@ public class XmppConnectionService extends Service { } public synchronized void updateUnreadCountBadge() { - int count = unreadCount(); - if (unreadCount != count) { - Log.d(Config.LOGTAG, "update unread count to " + count); - if (count > 0) { - ShortcutBadger.applyCount(getApplicationContext(), count); - } else { - ShortcutBadger.removeCount(getApplicationContext()); + new Thread(new Runnable() { + + @Override + public void run() { + int count = unreadCount(); + if (unreadCount != count) { + Log.d(Config.LOGTAG, "update unread count to " + count); + if (count > 0) { + ShortcutBadger.applyCount(getApplicationContext(), count); + } else { + ShortcutBadger.removeCount(getApplicationContext()); + } + unreadCount = count; + } } - unreadCount = count; - } + }).start(); } public void sendReadMarker(final Conversation conversation) { |