1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-08-13 17:03:48 -04:00

First pass at a sane "restore list state" behavior when going back to a

messagelist from a message view
This commit is contained in:
Jesse Vincent 2010-10-08 05:34:33 +00:00
parent 78f797dda8
commit 945bccd633
2 changed files with 23 additions and 2 deletions

View File

@ -21,6 +21,7 @@ public class MessageInfoHolder
public boolean flagged; public boolean flagged;
public boolean downloaded; public boolean downloaded;
public boolean partially_downloaded; public boolean partially_downloaded;
public boolean dirty;
public Message message; public Message message;
public FolderInfoHolder folder; public FolderInfoHolder folder;
public boolean selected; public boolean selected;

View File

@ -771,11 +771,11 @@ public class MessageList
mController.addListener(mAdapter.mListener); mController.addListener(mAdapter.mListener);
mAdapter.messages.clear(); mAdapter.messages.clear();
mAdapter.notifyDataSetChanged(); mAdapter.markAllMessagesAsDirty();
if (mFolderName != null) if (mFolderName != null)
{ {
mController.listLocalMessages(mAccount, mFolderName, mAdapter.mListener); mController.listLocalMessagesSynchronous(mAccount, mFolderName, mAdapter.mListener);
mController.notifyAccountCancel(this, mAccount); mController.notifyAccountCancel(this, mAccount);
MessagingController.getInstance(getApplication()).notifyAccountCancel(this, mAccount); MessagingController.getInstance(getApplication()).notifyAccountCancel(this, mAccount);
@ -788,6 +788,8 @@ public class MessageList
} }
mHandler.refreshTitle(); mHandler.refreshTitle();
mAdapter.pruneDirtyMessages();
mAdapter.notifyDataSetChanged();
restoreListState(); restoreListState();
} }
@ -2241,6 +2243,24 @@ public class MessageList
mAnsweredIcon = getResources().getDrawable(R.drawable.ic_mms_answered_small); mAnsweredIcon = getResources().getDrawable(R.drawable.ic_mms_answered_small);
} }
public void markAllMessagesAsDirty()
{
for (MessageInfoHolder holder : mAdapter.messages)
{
holder.dirty = true;
}
}
public void pruneDirtyMessages()
{
for (MessageInfoHolder holder : mAdapter.messages)
{
if (holder.dirty)
{
removeMessage(holder);
}
}
}
public void removeMessages(List<MessageInfoHolder> holders) public void removeMessages(List<MessageInfoHolder> holders)
{ {
if (holders != null) if (holders != null)