@Override public void listFoldersStarted(Account account) { if (account.equals(mAccount)) { mHandler.progress(true); } super.listFoldersStarted(account); }
@Override public void sendPendingMessagesFailed(Account account) { super.sendPendingMessagesFailed(account); if (account.equals(mAccount)) { refreshFolder(account, mAccount.getOutboxFolderName()); } }
@Override public void folderStatusChanged( Account account, String folderName, int unreadMessageCount) { if (account.equals(mAccount)) { refreshFolder(account, folderName); } }
@Override public void sendPendingMessagesStarted(Account account) { super.sendPendingMessagesStarted(account); if (account.equals(mAccount)) { mHandler.dataChanged(); } }
@Override public void synchronizeMailboxStarted(Account account, String folder) { super.synchronizeMailboxStarted(account, folder); if (account.equals(mAccount)) { mHandler.progress(true); mHandler.folderLoading(folder, true); mHandler.dataChanged(); } }
@Override public void listFoldersFinished(Account account) { if (account.equals(mAccount)) { mHandler.progress(false); MessagingController.getInstance(getApplication()).refreshListener(mAdapter.mListener); mHandler.dataChanged(); } super.listFoldersFinished(account); }
@Override public void synchronizeMailboxFinished( Account account, String folder, int totalMessagesInMailbox, int numNewMessages) { super.synchronizeMailboxFinished( account, folder, totalMessagesInMailbox, numNewMessages); if (account.equals(mAccount)) { mHandler.progress(false); mHandler.folderLoading(folder, false); refreshFolder(account, folder); } }
@Override public void listFoldersFailed(Account account, String message) { if (account.equals(mAccount)) { mHandler.progress(false); if (Config.LOGV) { Log.v(K9.LOG_TAG, "listFoldersFailed " + message); } } super.listFoldersFailed(account, message); }
@Override public void setPushActive(Account account, String folderName, boolean enabled) { if (!account.equals(mAccount)) { return; } FolderInfoHolder holder = getFolder(folderName); if (holder != null) { holder.pushActive = enabled; mHandler.dataChanged(); } }
@Override public void synchronizeMailboxFailed(Account account, String folder, String message) { super.synchronizeMailboxFailed(account, folder, message); if (!account.equals(mAccount)) { return; } mHandler.progress(false); mHandler.folderLoading(folder, false); // String mess = truncateStatus(message); // mHandler.folderStatus(folder, mess); FolderInfoHolder holder = getFolder(folder); if (holder != null) { holder.lastChecked = 0; } mHandler.dataChanged(); }
@Override public void emptyTrashCompleted(Account account) { if (account.equals(mAccount)) { refreshFolder(account, mAccount.getTrashFolderName()); } }
@Override public void listFolders(Account account, Folder[] folders) { if (account.equals(mAccount)) { 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); 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; } } catch (MessagingException me) { Log.e( K9.LOG_TAG, "Couldn't get prefs to check for displayability of folder " + folder.getName(), me); } 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()); } 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); } } Collections.sort(newFolders); Collections.sort(topFolders); topFolders.addAll(newFolders); mHandler.newFolders(topFolders); } super.listFolders(account, folders); }
@Override public void accountSizeChanged(Account account, long oldSize, long newSize) { if (account.equals(mAccount)) { mHandler.accountSizeChanged(oldSize, newSize); } }