Ejemplo n.º 1
0
  @Override
  public void onNewIntent(Intent intent) {
    setIntent(intent); // onNewIntent doesn't autoset our "internal" intent

    String initialFolder;

    mUnreadMessageCount = 0;
    String accountUuid = intent.getStringExtra(EXTRA_ACCOUNT);
    mAccount = Preferences.getPreferences(this).getAccount(accountUuid);

    if (mAccount == null) {
      // This shouldn't normally happen. But apparently it does. See issue 2261.
      finish();
      return;
    }

    initialFolder = intent.getStringExtra(EXTRA_INITIAL_FOLDER);
    boolean fromNotification = intent.getBooleanExtra(EXTRA_FROM_NOTIFICATION, false);
    if (fromNotification && mAccount.goToUnreadMessageSearch()) {
      MessagingController.getInstance(getApplication()).notifyAccountCancel(this, mAccount);
      openUnreadSearch(this, mAccount);
      finish();
    } else if (initialFolder != null && !K9.FOLDER_NONE.equals(initialFolder)) {
      onOpenFolder(initialFolder);
      finish();
    } else if (intent.getBooleanExtra(EXTRA_FROM_SHORTCUT, false)
        && !K9.FOLDER_NONE.equals(mAccount.getAutoExpandFolderName())) {
      onOpenFolder(mAccount.getAutoExpandFolderName());
      finish();
    } else {

      initializeActivityView();
    }
  }
Ejemplo n.º 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);
  }