Exemple #1
0
 @Override
 public void listFoldersStarted(Account account) {
   if (account.equals(mAccount)) {
     mHandler.progress(true);
   }
   super.listFoldersStarted(account);
 }
Exemple #2
0
 @Override
 public void sendPendingMessagesFailed(Account account) {
   super.sendPendingMessagesFailed(account);
   if (account.equals(mAccount)) {
     refreshFolder(account, mAccount.getOutboxFolderName());
   }
 }
Exemple #3
0
          @Override
          public void sendPendingMessagesStarted(Account account) {
            super.sendPendingMessagesStarted(account);

            if (account.equals(mAccount)) {
              mHandler.dataChanged();
            }
          }
Exemple #4
0
          @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();
            }
          }
Exemple #5
0
          @Override
          public void listFoldersFinished(Account account) {
            if (account.equals(mAccount)) {

              mHandler.progress(false);
              MessagingController.getInstance(getApplication()).refreshListener(mAdapter.mListener);
              mHandler.dataChanged();
            }
            super.listFoldersFinished(account);
          }
Exemple #6
0
 @Override
 public void accountStatusChanged(BaseAccount account, AccountStats stats) {
   if (!account.equals(mAccount)) {
     return;
   }
   if (stats == null) {
     return;
   }
   mUnreadMessageCount = stats.unreadMessageCount;
   super.accountStatusChanged(account, stats);
 }
Exemple #7
0
          @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);
            }
          }
Exemple #8
0
          @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);
          }
Exemple #9
0
          @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();
          }
Exemple #10
0
          @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);
          }