diff options
author | iNPUTmice <daniel@gultsch.de> | 2015-02-12 18:53:00 +0100 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2015-02-12 18:53:00 +0100 |
commit | e68c6a1b740928116cdb5cafa23a202302eefce3 (patch) | |
tree | 933d2d7e954989a46cab044735091d819d376b46 /src/main/java/eu/siacs/conversations/services | |
parent | 45de788773ffc62bd936fa9b4a5ca81a5a5c6010 (diff) |
load messages asynchronously
Diffstat (limited to 'src/main/java/eu/siacs/conversations/services')
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index c08e2c026..53abd5752 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -277,6 +277,11 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa private LruCache<String, Bitmap> mBitmapCache; private Thread mPhoneContactMergerThread; + private boolean mMessagesInitialized = false; + public boolean areMessagesInitialized() { + return this.mMessagesInitialized; + } + public PgpEngine getPgpEngine() { if (pgpServiceConnection.isBound()) { if (this.mPgpEngine == null) { @@ -889,9 +894,20 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa for (Conversation conversation : this.conversations) { Account account = accountLookupTable.get(conversation.getAccountUuid()); conversation.setAccount(account); - conversation.addAll(0, databaseBackend.getMessages(conversation, Config.PAGE_SIZE)); - checkDeletedFiles(conversation); } + new Thread(new Runnable() { + @Override + public void run() { + Log.d(Config.LOGTAG,"start initilizing messages"); + for (Conversation conversation : conversations) { + conversation.addAll(0, databaseBackend.getMessages(conversation, Config.PAGE_SIZE)); + checkDeletedFiles(conversation); + } + mMessagesInitialized = true; + Log.d(Config.LOGTAG,"done intilizing old messages"); + updateConversationUi(); + } + }).start(); } } |