1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

Fixes Issue 3177

Dynamically update the FolderList titlebar when the unread state of a
listed folder changes.  This implementation applies the folder unread
count delta to the account-level unread count, to avoid the expense of
recomputing the entire account's unread count.  If no FolderInfoHolder
for this folder already exists, skip the recomputation of the
account-level unread message count.
This commit is contained in:
danapple 2011-09-05 11:20:57 -05:00
parent 50e6218c1d
commit c67ac4735f

View File

@ -889,6 +889,8 @@ public class FolderList extends K9ListActivity {
int unreadMessageCount = localFolder.getUnreadMessageCount(); int unreadMessageCount = localFolder.getUnreadMessageCount();
FolderInfoHolder folderHolder = getFolder(folderName); FolderInfoHolder folderHolder = getFolder(folderName);
if (folderHolder != null) { if (folderHolder != null) {
int oldUnreadMessageCount = folderHolder.unreadMessageCount;
mUnreadMessageCount += unreadMessageCount - oldUnreadMessageCount;
folderHolder.populate(context, localFolder, mAccount, unreadMessageCount); folderHolder.populate(context, localFolder, mAccount, unreadMessageCount);
mHandler.dataChanged(); mHandler.dataChanged();
} }
@ -959,6 +961,7 @@ public class FolderList extends K9ListActivity {
public void folderStatusChanged(Account account, String folderName, int unreadMessageCount) { public void folderStatusChanged(Account account, String folderName, int unreadMessageCount) {
if (account.equals(mAccount)) { if (account.equals(mAccount)) {
refreshFolder(account, folderName); refreshFolder(account, folderName);
informUserOfStatus();
} }
} }