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

When we sync messages and are displaying a messagelist, do the listview

updates on the UI thread rather than the sync thread. This is a huge
performance boost (based on simple empirical testing) for initial syncs
as we now do more work as we add messages to message lists
This commit is contained in:
Jesse Vincent 2010-08-31 03:57:02 +00:00
parent db1b86a296
commit 7bd8fc3599

View File

@ -2054,8 +2054,12 @@ 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> messages, final boolean verifyAgainstSearch)
{ {
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>();
@ -2130,7 +2134,10 @@ public class MessageList
mHandler.resetUnreadCount(); mHandler.resetUnreadCount();
} }
} }
}
);
}
public MessageInfoHolder getMessage(Message message) public MessageInfoHolder getMessage(Message message)
{ {
return getMessage(message.makeMessageReference()); return getMessage(message.makeMessageReference());