From e8fd9683e663f7b610c48db04c54990dde296d97 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Mon, 11 Oct 2010 19:47:41 +0000 Subject: [PATCH] Optimize the new return-to-listview code. (Avoid a bug where we do far too much work on first open of a message list) --- src/com/fsck/k9/activity/MessageList.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/com/fsck/k9/activity/MessageList.java b/src/com/fsck/k9/activity/MessageList.java index 9e694818d..0a61e4e55 100644 --- a/src/com/fsck/k9/activity/MessageList.java +++ b/src/com/fsck/k9/activity/MessageList.java @@ -771,7 +771,6 @@ public class MessageList sortDateAscending = mController.isSortAscending(SORT_TYPE.SORT_DATE); mController.addListener(mAdapter.mListener); - mAdapter.markAllMessagesAsDirty(); if (mFolderName != null) { @@ -781,7 +780,10 @@ public class MessageList } else { + mAdapter.markAllMessagesAsDirty(); mController.listLocalMessagesSynchronous(mAccount, mFolderName, mAdapter.mListener); + mAdapter.pruneDirtyMessages(); + mAdapter.notifyDataSetChanged(); } mController.notifyAccountCancel(this, mAccount); @@ -795,8 +797,6 @@ public class MessageList } mHandler.refreshTitle(); - mAdapter.pruneDirtyMessages(); - mAdapter.notifyDataSetChanged(); restoreListState(); }