1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-24 02:12:15 -05:00

do our messagelist updates from sync on the ui thread rather than the

sync thread. copy the incoming message list to deal with concurrent
access issues.  Patch by cketti++
This commit is contained in:
Jesse Vincent 2010-09-02 03:45:16 +00:00
parent 08f10f1fe5
commit 6573f27cec

View File

@ -2058,8 +2058,16 @@ public class MessageList
addOrUpdateMessages(account, folder, messages, verifyAgainstSearch); addOrUpdateMessages(account, folder, messages, verifyAgainstSearch);
} }
private void addOrUpdateMessages(Account account, String folder, List<Message> messages, boolean verifyAgainstSearch) private void addOrUpdateMessages(final Account account, final String folder, final List<Message> providedMessages, final boolean verifyAgainstSearch)
{ {
// we copy the message list because the callback doesn't expect
// the callbacks to mutate it.
final List<Message> messages = new ArrayList<Message>(providedMessages);
runOnUiThread(new Runnable()
{
public void run()
{
boolean needsSort = false; boolean needsSort = false;
final List<MessageInfoHolder> messagesToAdd = new ArrayList<MessageInfoHolder>(); final List<MessageInfoHolder> messagesToAdd = new ArrayList<MessageInfoHolder>();
List<MessageInfoHolder> messagesToRemove = new ArrayList<MessageInfoHolder>(); List<MessageInfoHolder> messagesToRemove = new ArrayList<MessageInfoHolder>();
@ -2133,6 +2141,8 @@ public class MessageList
mHandler.sortMessages(); mHandler.sortMessages();
mHandler.resetUnreadCount(); mHandler.resetUnreadCount();
} }
}
});
} }
public MessageInfoHolder getMessage(Message message) public MessageInfoHolder getMessage(Message message)
{ {