mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-31 15:20:09 -05:00
Move the "update the title" code from almost every single
ActivityListener callback to the superclass, removing the need for many sublcass methods
This commit is contained in:
parent
7cbbd72fac
commit
260b933a3b
@ -131,6 +131,11 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
}
|
||||
|
||||
ActivityListener mListener = new ActivityListener() {
|
||||
@Override
|
||||
public void informUserOfStatus() {
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void folderStatusChanged(Account account, String folderName, int unreadMessageCount) {
|
||||
try {
|
||||
@ -181,25 +186,17 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
String folder,
|
||||
int totalMessagesInMailbox,
|
||||
int numNewMessages) {
|
||||
super.synchronizeMailboxFinished(account, folder, totalMessagesInMailbox, numNewMessages);
|
||||
MessagingController.getInstance(getApplication()).getAccountStats(Accounts.this, account, mListener);
|
||||
super.synchronizeMailboxFinished(account, folder, totalMessagesInMailbox, numNewMessages);
|
||||
|
||||
mHandler.progress(false);
|
||||
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronizeMailboxStarted(Account account, String folder) {
|
||||
super.synchronizeMailboxStarted(account, folder);
|
||||
mHandler.progress(true);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronizeMailboxProgress(Account account, String folder, int completed, int total) {
|
||||
super.synchronizeMailboxProgress(account, folder, completed, total);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -207,57 +204,9 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
String message) {
|
||||
super.synchronizeMailboxFailed(account, folder, message);
|
||||
mHandler.progress(false);
|
||||
mHandler.refreshTitle();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPendingMessagesStarted(Account account) {
|
||||
super.sendPendingMessagesStarted(account);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPendingMessagesCompleted(Account account) {
|
||||
super.sendPendingMessagesCompleted(account);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendPendingMessagesFailed(Account account) {
|
||||
super.sendPendingMessagesFailed(account);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pendingCommandsProcessing(Account account) {
|
||||
super.pendingCommandsProcessing(account);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pendingCommandsFinished(Account account) {
|
||||
super.pendingCommandsFinished(account);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pendingCommandStarted(Account account, String commandTitle) {
|
||||
super.pendingCommandStarted(account, commandTitle);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pendingCommandCompleted(Account account, String commandTitle) {
|
||||
super.pendingCommandCompleted(account, commandTitle);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void systemStatusChanged() {
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
};
|
||||
|
||||
private static String ACCOUNT_STATS = "accountStats";
|
||||
@ -299,7 +248,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
finish();
|
||||
} else if (startup && accounts.length == 1 && onOpenAccount(accounts[0])) {
|
||||
// fall through to "else" if !onOpenAccount()
|
||||
finish();
|
||||
finish();
|
||||
} else {
|
||||
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
requestWindowFeature(Window.FEATURE_PROGRESS);
|
||||
|
@ -5,6 +5,7 @@ import java.text.DateFormat;
|
||||
import android.content.Context;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.AccountStats;
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.R;
|
||||
import com.fsck.k9.controller.MessagingListener;
|
||||
@ -70,6 +71,9 @@ public class ActivityListener extends MessagingListener {
|
||||
|
||||
}
|
||||
|
||||
public void informUserOfStatus() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronizeMailboxFinished(
|
||||
Account account,
|
||||
@ -78,6 +82,7 @@ public class ActivityListener extends MessagingListener {
|
||||
int numNewMessages) {
|
||||
mLoadingAccountDescription = null;
|
||||
mLoadingFolderName = null;
|
||||
informUserOfStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -86,12 +91,14 @@ public class ActivityListener extends MessagingListener {
|
||||
mLoadingFolderName = folder;
|
||||
mFolderCompleted = 0;
|
||||
mFolderTotal = 0;
|
||||
informUserOfStatus();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void synchronizeMailboxHeadersStarted(Account account, String folder) {
|
||||
mLoadingHeaderFolderName = folder;
|
||||
informUserOfStatus();
|
||||
}
|
||||
|
||||
|
||||
@ -99,6 +106,7 @@ public class ActivityListener extends MessagingListener {
|
||||
public void synchronizeMailboxHeadersProgress(Account account, String folder, int completed, int total) {
|
||||
mFolderCompleted = completed;
|
||||
mFolderTotal = total;
|
||||
informUserOfStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -107,6 +115,7 @@ public class ActivityListener extends MessagingListener {
|
||||
mLoadingHeaderFolderName = null;
|
||||
mFolderCompleted = 0;
|
||||
mFolderTotal = 0;
|
||||
informUserOfStatus();
|
||||
}
|
||||
|
||||
|
||||
@ -114,6 +123,7 @@ public class ActivityListener extends MessagingListener {
|
||||
public void synchronizeMailboxProgress(Account account, String folder, int completed, int total) {
|
||||
mFolderCompleted = completed;
|
||||
mFolderTotal = total;
|
||||
informUserOfStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -121,22 +131,26 @@ public class ActivityListener extends MessagingListener {
|
||||
String message) {
|
||||
mLoadingAccountDescription = null;
|
||||
mLoadingFolderName = null;
|
||||
informUserOfStatus();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPendingMessagesStarted(Account account) {
|
||||
mSendingAccountDescription = account.getDescription();
|
||||
informUserOfStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPendingMessagesCompleted(Account account) {
|
||||
mSendingAccountDescription = null;
|
||||
informUserOfStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPendingMessagesFailed(Account account) {
|
||||
mSendingAccountDescription = null;
|
||||
informUserOfStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -144,27 +158,46 @@ public class ActivityListener extends MessagingListener {
|
||||
mProcessingAccountDescription = account.getDescription();
|
||||
mFolderCompleted = 0;
|
||||
mFolderTotal = 0;
|
||||
informUserOfStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pendingCommandsFinished(Account account) {
|
||||
mProcessingAccountDescription = null;
|
||||
informUserOfStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pendingCommandStarted(Account account, String commandTitle) {
|
||||
mProcessingCommandTitle = commandTitle;
|
||||
informUserOfStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pendingCommandCompleted(Account account, String commandTitle) {
|
||||
mProcessingCommandTitle = null;
|
||||
informUserOfStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void searchStats(AccountStats stats) {
|
||||
informUserOfStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void systemStatusChanged() {
|
||||
informUserOfStatus();
|
||||
}
|
||||
@Override
|
||||
public void folderStatusChanged(Account account, String folder, int unreadMessageCount) {
|
||||
informUserOfStatus();
|
||||
}
|
||||
|
||||
public int getFolderCompleted() {
|
||||
return mFolderCompleted;
|
||||
}
|
||||
|
||||
|
||||
public int getFolderTotal() {
|
||||
return mFolderTotal;
|
||||
}
|
||||
|
@ -745,6 +745,10 @@ public class FolderList extends K9ListActivity {
|
||||
}
|
||||
|
||||
private ActivityListener mListener = new ActivityListener() {
|
||||
@Override
|
||||
public void informUserOfStatus() {
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
@Override
|
||||
public void accountStatusChanged(BaseAccount account, AccountStats stats) {
|
||||
if (!account.equals(mAccount)) {
|
||||
@ -754,162 +758,124 @@ public class FolderList extends K9ListActivity {
|
||||
return;
|
||||
}
|
||||
mUnreadMessageCount = stats.unreadMessageCount;
|
||||
mHandler.refreshTitle();
|
||||
super.accountStatusChanged(account, stats);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void listFoldersStarted(Account account) {
|
||||
if (!account.equals(mAccount)) {
|
||||
return;
|
||||
if (account.equals(mAccount)) {
|
||||
mHandler.progress(true);
|
||||
}
|
||||
super.listFoldersStarted(account);
|
||||
|
||||
mHandler.progress(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void listFoldersFailed(Account account, String message) {
|
||||
if (!account.equals(mAccount)) {
|
||||
return;
|
||||
}
|
||||
if (account.equals(mAccount)) {
|
||||
|
||||
mHandler.progress(false);
|
||||
mHandler.progress(false);
|
||||
|
||||
if (Config.LOGV) {
|
||||
Log.v(K9.LOG_TAG, "listFoldersFailed " + message);
|
||||
if (Config.LOGV) {
|
||||
Log.v(K9.LOG_TAG, "listFoldersFailed " + message);
|
||||
}
|
||||
}
|
||||
super.listFoldersFailed(account, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void listFoldersFinished(Account account) {
|
||||
if (!account.equals(mAccount)) {
|
||||
return;
|
||||
}
|
||||
if (account.equals(mAccount)) {
|
||||
|
||||
mHandler.progress(false);
|
||||
MessagingController.getInstance(getApplication()).refreshListener(mAdapter.mListener);
|
||||
mHandler.dataChanged();
|
||||
mHandler.progress(false);
|
||||
MessagingController.getInstance(getApplication()).refreshListener(mAdapter.mListener);
|
||||
mHandler.dataChanged();
|
||||
}
|
||||
super.listFoldersFinished(account);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void listFolders(Account account, Folder[] folders) {
|
||||
if (!account.equals(mAccount)) {
|
||||
return;
|
||||
}
|
||||
if (account.equals(mAccount)) {
|
||||
|
||||
List<FolderInfoHolder> newFolders = new LinkedList<FolderInfoHolder>();
|
||||
List<FolderInfoHolder> topFolders = new LinkedList<FolderInfoHolder>();
|
||||
List<FolderInfoHolder> newFolders = new LinkedList<FolderInfoHolder>();
|
||||
List<FolderInfoHolder> topFolders = new LinkedList<FolderInfoHolder>();
|
||||
|
||||
Account.FolderMode aMode = account.getFolderDisplayMode();
|
||||
Preferences prefs = Preferences.getPreferences(getApplication().getApplicationContext());
|
||||
for (Folder folder : folders) {
|
||||
try {
|
||||
folder.refresh(prefs);
|
||||
Account.FolderMode aMode = account.getFolderDisplayMode();
|
||||
Preferences prefs = Preferences.getPreferences(getApplication().getApplicationContext());
|
||||
for (Folder folder : folders) {
|
||||
try {
|
||||
folder.refresh(prefs);
|
||||
|
||||
Folder.FolderClass fMode = folder.getDisplayClass();
|
||||
Folder.FolderClass fMode = folder.getDisplayClass();
|
||||
|
||||
if ((aMode == Account.FolderMode.FIRST_CLASS && fMode != Folder.FolderClass.FIRST_CLASS)
|
||||
|| (aMode == Account.FolderMode.FIRST_AND_SECOND_CLASS &&
|
||||
fMode != Folder.FolderClass.FIRST_CLASS &&
|
||||
fMode != Folder.FolderClass.SECOND_CLASS)
|
||||
|| (aMode == Account.FolderMode.NOT_SECOND_CLASS && fMode == Folder.FolderClass.SECOND_CLASS)) {
|
||||
continue;
|
||||
if ((aMode == Account.FolderMode.FIRST_CLASS && fMode != Folder.FolderClass.FIRST_CLASS)
|
||||
|| (aMode == Account.FolderMode.FIRST_AND_SECOND_CLASS &&
|
||||
fMode != Folder.FolderClass.FIRST_CLASS &&
|
||||
fMode != Folder.FolderClass.SECOND_CLASS)
|
||||
|| (aMode == Account.FolderMode.NOT_SECOND_CLASS && fMode == Folder.FolderClass.SECOND_CLASS)) {
|
||||
continue;
|
||||
}
|
||||
} catch (MessagingException me) {
|
||||
Log.e(K9.LOG_TAG, "Couldn't get prefs to check for displayability of folder " + folder.getName(), me);
|
||||
}
|
||||
} catch (MessagingException me) {
|
||||
Log.e(K9.LOG_TAG, "Couldn't get prefs to check for displayability of folder " + folder.getName(), me);
|
||||
}
|
||||
|
||||
FolderInfoHolder holder = null;
|
||||
FolderInfoHolder holder = null;
|
||||
|
||||
int folderIndex = getFolderIndex(folder.getName());
|
||||
if (folderIndex >= 0) {
|
||||
holder = (FolderInfoHolder) getItem(folderIndex);
|
||||
}
|
||||
int unreadMessageCount = 0;
|
||||
try {
|
||||
unreadMessageCount = folder.getUnreadMessageCount();
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to get unreadMessageCount for " + mAccount.getDescription() + ":"
|
||||
+ folder.getName());
|
||||
}
|
||||
int folderIndex = getFolderIndex(folder.getName());
|
||||
if (folderIndex >= 0) {
|
||||
holder = (FolderInfoHolder) getItem(folderIndex);
|
||||
}
|
||||
int unreadMessageCount = 0;
|
||||
try {
|
||||
unreadMessageCount = folder.getUnreadMessageCount();
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Unable to get unreadMessageCount for " + mAccount.getDescription() + ":"
|
||||
+ folder.getName());
|
||||
}
|
||||
|
||||
if (holder == null) {
|
||||
holder = new FolderInfoHolder(context, folder, mAccount, unreadMessageCount);
|
||||
} else {
|
||||
holder.populate(context, folder, mAccount, unreadMessageCount);
|
||||
if (holder == null) {
|
||||
holder = new FolderInfoHolder(context, folder, mAccount, unreadMessageCount);
|
||||
} else {
|
||||
holder.populate(context, folder, mAccount, unreadMessageCount);
|
||||
|
||||
}
|
||||
if (folder.isInTopGroup()) {
|
||||
topFolders.add(holder);
|
||||
} else {
|
||||
newFolders.add(holder);
|
||||
}
|
||||
}
|
||||
if (folder.isInTopGroup()) {
|
||||
topFolders.add(holder);
|
||||
} else {
|
||||
newFolders.add(holder);
|
||||
}
|
||||
Collections.sort(newFolders);
|
||||
Collections.sort(topFolders);
|
||||
topFolders.addAll(newFolders);
|
||||
mHandler.newFolders(topFolders);
|
||||
}
|
||||
Collections.sort(newFolders);
|
||||
Collections.sort(topFolders);
|
||||
topFolders.addAll(newFolders);
|
||||
mHandler.newFolders(topFolders);
|
||||
mHandler.refreshTitle();
|
||||
|
||||
super.listFolders(account, folders);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronizeMailboxStarted(Account account, String folder) {
|
||||
super.synchronizeMailboxStarted(account, folder);
|
||||
mHandler.refreshTitle();
|
||||
if (!account.equals(mAccount)) {
|
||||
return;
|
||||
if (account.equals(mAccount)) {
|
||||
|
||||
mHandler.progress(true);
|
||||
mHandler.folderLoading(folder, true);
|
||||
mHandler.dataChanged();
|
||||
}
|
||||
|
||||
mHandler.progress(true);
|
||||
mHandler.folderLoading(folder, true);
|
||||
mHandler.dataChanged();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronizeMailboxHeadersStarted(Account account, String folder) {
|
||||
|
||||
super.synchronizeMailboxHeadersStarted(account, folder);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void synchronizeMailboxHeadersProgress(Account account, String folder, int completed, int total) {
|
||||
super.synchronizeMailboxHeadersProgress(account, folder, completed, total);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronizeMailboxHeadersFinished(Account account, String folder,
|
||||
int total, int completed) {
|
||||
super.synchronizeMailboxHeadersFinished(account, folder, total, completed);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void synchronizeMailboxProgress(Account account, String folder, int completed, int total) {
|
||||
super.synchronizeMailboxProgress(account, folder, completed, total);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronizeMailboxFinished(Account account, String folder, int totalMessagesInMailbox, int numNewMessages) {
|
||||
super.synchronizeMailboxFinished(account, folder, totalMessagesInMailbox, numNewMessages);
|
||||
mHandler.refreshTitle();
|
||||
if (!account.equals(mAccount)) {
|
||||
return;
|
||||
if (account.equals(mAccount)) {
|
||||
mHandler.progress(false);
|
||||
mHandler.folderLoading(folder, false);
|
||||
|
||||
refreshFolder(account, folder);
|
||||
}
|
||||
mHandler.progress(false);
|
||||
mHandler.folderLoading(folder, false);
|
||||
|
||||
refreshFolder(account, folder);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -941,10 +907,8 @@ public class FolderList extends K9ListActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronizeMailboxFailed(Account account, String folder,
|
||||
String message) {
|
||||
public void synchronizeMailboxFailed(Account account, String folder, String message) {
|
||||
super.synchronizeMailboxFailed(account, folder, message);
|
||||
mHandler.refreshTitle();
|
||||
if (!account.equals(mAccount)) {
|
||||
return;
|
||||
}
|
||||
@ -983,105 +947,55 @@ public class FolderList extends K9ListActivity {
|
||||
|
||||
|
||||
@Override
|
||||
public void messageDeleted(Account account,
|
||||
String folder, Message message) {
|
||||
synchronizeMailboxRemovedMessage(account,
|
||||
folder, message);
|
||||
public void messageDeleted(Account account, String folder, Message message) {
|
||||
synchronizeMailboxRemovedMessage(account, folder, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void emptyTrashCompleted(Account account) {
|
||||
if (!account.equals(mAccount)) {
|
||||
return;
|
||||
if (account.equals(mAccount)) {
|
||||
refreshFolder(account, mAccount.getTrashFolderName());
|
||||
}
|
||||
refreshFolder(account, mAccount.getTrashFolderName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void folderStatusChanged(Account account, String folderName, int unreadMessageCount) {
|
||||
if (!account.equals(mAccount)) {
|
||||
return;
|
||||
if (account.equals(mAccount)) {
|
||||
refreshFolder(account, folderName);
|
||||
}
|
||||
refreshFolder(account, folderName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPendingMessagesCompleted(Account account) {
|
||||
super.sendPendingMessagesCompleted(account);
|
||||
mHandler.refreshTitle();
|
||||
if (!account.equals(mAccount)) {
|
||||
return;
|
||||
if (account.equals(mAccount)) {
|
||||
refreshFolder(account, mAccount.getOutboxFolderName());
|
||||
}
|
||||
|
||||
refreshFolder(account, mAccount.getOutboxFolderName());
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPendingMessagesStarted(Account account) {
|
||||
super.sendPendingMessagesStarted(account);
|
||||
mHandler.refreshTitle();
|
||||
|
||||
if (!account.equals(mAccount)) {
|
||||
return;
|
||||
if (account.equals(mAccount)) {
|
||||
mHandler.dataChanged();
|
||||
}
|
||||
|
||||
mHandler.dataChanged();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPendingMessagesFailed(Account account) {
|
||||
super.sendPendingMessagesFailed(account);
|
||||
mHandler.refreshTitle();
|
||||
if (!account.equals(mAccount)) {
|
||||
return;
|
||||
if (account.equals(mAccount)) {
|
||||
refreshFolder(account, mAccount.getOutboxFolderName());
|
||||
}
|
||||
|
||||
refreshFolder(account, mAccount.getOutboxFolderName());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accountSizeChanged(Account account, long oldSize, long newSize) {
|
||||
if (!account.equals(mAccount)) {
|
||||
return;
|
||||
if (account.equals(mAccount)) {
|
||||
mHandler.accountSizeChanged(oldSize, newSize);
|
||||
}
|
||||
|
||||
mHandler.accountSizeChanged(oldSize, newSize);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pendingCommandsProcessing(Account account) {
|
||||
super.pendingCommandsProcessing(account);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pendingCommandsFinished(Account account) {
|
||||
super.pendingCommandsFinished(account);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pendingCommandStarted(Account account, String commandTitle) {
|
||||
super.pendingCommandStarted(account, commandTitle);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pendingCommandCompleted(Account account, String commandTitle) {
|
||||
super.pendingCommandCompleted(account, commandTitle);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void systemStatusChanged() {
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -1716,79 +1716,42 @@ public class MessageList
|
||||
private final List<MessageInfoHolder> messages = java.util.Collections.synchronizedList(new ArrayList<MessageInfoHolder>());
|
||||
|
||||
private final ActivityListener mListener = new ActivityListener() {
|
||||
|
||||
@Override
|
||||
public void informUserOfStatus() {
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronizeMailboxStarted(Account account, String folder) {
|
||||
super.synchronizeMailboxStarted(account, folder);
|
||||
|
||||
if (updateForMe(account, folder)) {
|
||||
mHandler.progress(true);
|
||||
mHandler.folderLoading(folder, true);
|
||||
}
|
||||
mHandler.refreshTitle();
|
||||
super.synchronizeMailboxStarted(account, folder);
|
||||
}
|
||||
@Override
|
||||
public void synchronizeMailboxHeadersProgress(Account account, String folder, int completed, int total) {
|
||||
super.synchronizeMailboxHeadersProgress(account, folder, completed, total);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronizeMailboxHeadersFinished(Account account, String folder,
|
||||
int total, int completed) {
|
||||
super.synchronizeMailboxHeadersFinished(account, folder, total, completed);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void synchronizeMailboxFinished(Account account, String folder,
|
||||
int totalMessagesInMailbox, int numNewMessages) {
|
||||
super.synchronizeMailboxFinished(account, folder, totalMessagesInMailbox, numNewMessages);
|
||||
|
||||
if (updateForMe(account, folder)) {
|
||||
mHandler.progress(false);
|
||||
mHandler.folderLoading(folder, false);
|
||||
mHandler.sortMessages();
|
||||
}
|
||||
mHandler.refreshTitle();
|
||||
super.synchronizeMailboxFinished(account, folder, totalMessagesInMailbox, numNewMessages);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronizeMailboxFailed(Account account, String folder, String message) {
|
||||
super.synchronizeMailboxFailed(account, folder, message);
|
||||
|
||||
if (updateForMe(account, folder)) {
|
||||
mHandler.progress(false);
|
||||
mHandler.folderLoading(folder, false);
|
||||
mHandler.sortMessages();
|
||||
}
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPendingMessagesStarted(Account account) {
|
||||
super.sendPendingMessagesStarted(account);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPendingMessagesCompleted(Account account) {
|
||||
super.sendPendingMessagesCompleted(account);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPendingMessagesFailed(Account account) {
|
||||
super.sendPendingMessagesFailed(account);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronizeMailboxProgress(Account account, String folder, int completed, int total) {
|
||||
super.synchronizeMailboxProgress(account, folder, completed, total);
|
||||
mHandler.refreshTitle();
|
||||
super.synchronizeMailboxFailed(account, folder, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1808,9 +1771,7 @@ public class MessageList
|
||||
|
||||
@Override
|
||||
public void listLocalMessagesStarted(Account account, String folder) {
|
||||
if ((mQueryString != null && folder == null) ||
|
||||
(account != null && account.equals(mAccount))
|
||||
) {
|
||||
if ((mQueryString != null && folder == null) || (account != null && account.equals(mAccount))) {
|
||||
mHandler.progress(true);
|
||||
if (folder != null) {
|
||||
mHandler.folderLoading(folder, true);
|
||||
@ -1820,8 +1781,7 @@ public class MessageList
|
||||
|
||||
@Override
|
||||
public void listLocalMessagesFailed(Account account, String folder, String message) {
|
||||
if ((mQueryString != null && folder == null) ||
|
||||
(account != null && account.equals(mAccount))) {
|
||||
if ((mQueryString != null && folder == null) || (account != null && account.equals(mAccount))) {
|
||||
mHandler.sortMessages();
|
||||
mHandler.progress(false);
|
||||
if (folder != null) {
|
||||
@ -1832,8 +1792,7 @@ public class MessageList
|
||||
|
||||
@Override
|
||||
public void listLocalMessagesFinished(Account account, String folder) {
|
||||
if ((mQueryString != null && folder == null) ||
|
||||
(account != null && account.equals(mAccount))) {
|
||||
if ((mQueryString != null && folder == null) || (account != null && account.equals(mAccount))) {
|
||||
mHandler.sortMessages();
|
||||
mHandler.progress(false);
|
||||
if (folder != null) {
|
||||
@ -1863,40 +1822,15 @@ public class MessageList
|
||||
@Override
|
||||
public void searchStats(AccountStats stats) {
|
||||
mUnreadMessageCount = stats.unreadMessageCount;
|
||||
mHandler.refreshTitle();
|
||||
super.searchStats(stats);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void folderStatusChanged(Account account, String folder, int unreadMessageCount) {
|
||||
super.folderStatusChanged(account, folder, unreadMessageCount);
|
||||
if (updateForMe(account, folder)) {
|
||||
mUnreadMessageCount = unreadMessageCount;
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pendingCommandsProcessing(Account account) {
|
||||
super.pendingCommandsProcessing(account);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pendingCommandsFinished(Account account) {
|
||||
super.pendingCommandsFinished(account);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pendingCommandStarted(Account account, String commandTitle) {
|
||||
super.pendingCommandStarted(account, commandTitle);
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pendingCommandCompleted(Account account, String commandTitle) {
|
||||
super.pendingCommandCompleted(account, commandTitle);
|
||||
mHandler.refreshTitle();
|
||||
super.folderStatusChanged(account, folder, unreadMessageCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1912,11 +1846,6 @@ public class MessageList
|
||||
holder.message.setUid(newUid);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void systemStatusChanged() {
|
||||
mHandler.refreshTitle();
|
||||
}
|
||||
};
|
||||
|
||||
private boolean updateForMe(Account account, String folder) {
|
||||
|
Loading…
Reference in New Issue
Block a user