1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Make folder unread counters work properly with new faster delete and

marking
This commit is contained in:
Daniel Applebaum 2009-01-03 14:35:41 +00:00
parent 73006c65a3
commit d9dd06a620

View File

@ -751,7 +751,10 @@ public class FolderMessageList extends ExpandableListActivity
private void onDelete(MessageInfoHolder holder) private void onDelete(MessageInfoHolder holder)
{ {
if (holder.read == false && holder.folder.unreadMessageCount > 0)
{
holder.folder.unreadMessageCount--;
}
MessagingController.getInstance(getApplication()).deleteMessage(mAccount, MessagingController.getInstance(getApplication()).deleteMessage(mAccount,
holder.message.getFolder().getName(), holder.message, null); holder.message.getFolder().getName(), holder.message, null);
mAdapter.removeMessage(holder.message.getFolder().getName(), holder.uid); mAdapter.removeMessage(holder.message.getFolder().getName(), holder.uid);
@ -783,6 +786,7 @@ public class FolderMessageList extends ExpandableListActivity
for (MessageInfoHolder holder : folder.messages){ for (MessageInfoHolder holder : folder.messages){
holder.read = true; holder.read = true;
} }
folder.unreadMessageCount = 0;
mHandler.dataChanged(); mHandler.dataChanged();
//onRefresh(false); //onRefresh(false);
@ -796,6 +800,13 @@ public class FolderMessageList extends ExpandableListActivity
private void onToggleRead(MessageInfoHolder holder) private void onToggleRead(MessageInfoHolder holder)
{ {
holder.folder.unreadMessageCount += (holder.read ? 1 : -1);
if (holder.folder.unreadMessageCount < 0)
{
holder.folder.unreadMessageCount = 0;
}
MessagingController.getInstance(getApplication()).markMessageRead(mAccount, MessagingController.getInstance(getApplication()).markMessageRead(mAccount,
holder.message.getFolder().getName(), holder.uid, !holder.read); holder.message.getFolder().getName(), holder.uid, !holder.read);
holder.read = !holder.read; holder.read = !holder.read;
@ -1763,6 +1774,8 @@ public class FolderMessageList extends ExpandableListActivity
public Message message; public Message message;
public FolderInfoHolder folder;
public MessageInfoHolder(Message m, FolderInfoHolder folder) public MessageInfoHolder(Message m, FolderInfoHolder folder)
{ {
populate(m, folder); populate(m, folder);
@ -1775,6 +1788,7 @@ public class FolderMessageList extends ExpandableListActivity
LocalMessage message = (LocalMessage) m; LocalMessage message = (LocalMessage) m;
Date date = message.getSentDate(); Date date = message.getSentDate();
this.compareDate = date; this.compareDate = date;
this.folder = folder;
if (Utility.isDateToday(date)) if (Utility.isDateToday(date))
{ {
this.date = getTimeFormat().format(date); this.date = getTimeFormat().format(date);