Exemple #1
0
  @SuppressWarnings("unchecked")
  private void restorePreviousData() {
    final Object previousData = getLastNonConfigurationInstance();

    if (previousData != null) {
      mAdapter.mFolders = (ArrayList<FolderInfoHolder>) previousData;
    }
  }
Exemple #2
0
  @Override
  public boolean onContextItemSelected(MenuItem item) {
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    FolderInfoHolder folder = (FolderInfoHolder) mAdapter.getItem(info.position);

    switch (item.getItemId()) {
      case R.id.open_folder:
        onOpenFolder(folder.name);
        break;

      case R.id.mark_all_as_read:
        onMarkAllAsRead(mAccount, folder.name);
        break;

      case R.id.send_messages:
        sendMail(mAccount);

        break;

      case R.id.check_mail:
        checkMail(folder);

        break;

      case R.id.folder_settings:
        onEditFolder(mAccount, folder.name);

        break;

      case R.id.empty_trash:
        onEmptyTrash(mAccount);

        break;
      case R.id.expunge:
        onExpunge(mAccount, folder.name);

        break;

      case R.id.clear_local_folder:
        onClearFolder(mAccount, folder.name);
        break;
    }

    return super.onContextItemSelected(item);
  }
Exemple #3
0
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    getMenuInflater().inflate(R.menu.folder_context, menu);

    FolderInfoHolder folder = (FolderInfoHolder) mAdapter.getItem(info.position);

    menu.setHeaderTitle(folder.displayName);

    if (!folder.name.equals(mAccount.getTrashFolderName()))
      menu.findItem(R.id.empty_trash).setVisible(false);

    if (folder.name.equals(mAccount.getOutboxFolderName())) {
      menu.findItem(R.id.check_mail).setVisible(false);
    } else {
      menu.findItem(R.id.send_messages).setVisible(false);
    }
    if (K9.ERROR_FOLDER_NAME.equals(folder.name)) {
      menu.findItem(R.id.expunge).setVisible(false);
    }

    menu.setHeaderTitle(folder.displayName);
  }
Exemple #4
0
 private void onMarkAllAsRead(final Account account, final String folder) {
   mSelectedContextFolder = mAdapter.getFolder(folder);
   showDialog(DIALOG_MARK_ALL_AS_READ);
 }