mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-12 06:08:25 -05: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:
parent
78f797dda8
commit
945bccd633
@ -21,6 +21,7 @@ public class MessageInfoHolder
|
||||
public boolean flagged;
|
||||
public boolean downloaded;
|
||||
public boolean partially_downloaded;
|
||||
public boolean dirty;
|
||||
public Message message;
|
||||
public FolderInfoHolder folder;
|
||||
public boolean selected;
|
||||
|
@ -771,11 +771,11 @@ public class MessageList
|
||||
|
||||
mController.addListener(mAdapter.mListener);
|
||||
mAdapter.messages.clear();
|
||||
mAdapter.notifyDataSetChanged();
|
||||
mAdapter.markAllMessagesAsDirty();
|
||||
|
||||
if (mFolderName != null)
|
||||
{
|
||||
mController.listLocalMessages(mAccount, mFolderName, mAdapter.mListener);
|
||||
mController.listLocalMessagesSynchronous(mAccount, mFolderName, mAdapter.mListener);
|
||||
mController.notifyAccountCancel(this, mAccount);
|
||||
|
||||
MessagingController.getInstance(getApplication()).notifyAccountCancel(this, mAccount);
|
||||
@ -788,6 +788,8 @@ public class MessageList
|
||||
}
|
||||
|
||||
mHandler.refreshTitle();
|
||||
mAdapter.pruneDirtyMessages();
|
||||
mAdapter.notifyDataSetChanged();
|
||||
|
||||
restoreListState();
|
||||
}
|
||||
@ -2241,6 +2243,24 @@ public class MessageList
|
||||
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)
|
||||
{
|
||||
if (holders != null)
|
||||
|
Loading…
Reference in New Issue
Block a user