示例#1
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    int itemId = item.getItemId();
    switch (itemId) {
      case android.R.id.home:
        {
          goBack();
          return true;
        }
      case R.id.compose:
        {
          mMessageListFragment.onCompose();
          return true;
        }
      case R.id.toggle_message_view_theme:
        {
          onToggleTheme();
          return true;
        }
        // MessageList
      case R.id.check_mail:
        {
          mMessageListFragment.checkMail();
          return true;
        }
      case R.id.set_sort_date:
        {
          mMessageListFragment.changeSort(SortType.SORT_DATE);
          return true;
        }
      case R.id.set_sort_arrival:
        {
          mMessageListFragment.changeSort(SortType.SORT_ARRIVAL);
          return true;
        }
      case R.id.set_sort_subject:
        {
          mMessageListFragment.changeSort(SortType.SORT_SUBJECT);
          return true;
        }
        //            case R.id.set_sort_sender: {
        //                mMessageListFragment.changeSort(SortType.SORT_SENDER);
        //                return true;
        //            }
      case R.id.set_sort_flag:
        {
          mMessageListFragment.changeSort(SortType.SORT_FLAGGED);
          return true;
        }
      case R.id.set_sort_unread:
        {
          mMessageListFragment.changeSort(SortType.SORT_UNREAD);
          return true;
        }
      case R.id.set_sort_attach:
        {
          mMessageListFragment.changeSort(SortType.SORT_ATTACHMENT);
          return true;
        }
      case R.id.select_all:
        {
          mMessageListFragment.selectAll();
          return true;
        }
      case R.id.app_settings:
        {
          onEditPrefs();
          return true;
        }
      case R.id.account_settings:
        {
          onEditAccount();
          return true;
        }
      case R.id.search:
        {
          mMessageListFragment.onSearchRequested();
          return true;
        }
      case R.id.search_remote:
        {
          mMessageListFragment.onRemoteSearch();
          return true;
        }
        // MessageView
      case R.id.next_message:
        {
          showNextMessage();
          return true;
        }
      case R.id.previous_message:
        {
          showPreviousMessage();
          return true;
        }
      case R.id.delete:
        {
          mMessageViewFragment.onDelete();
          return true;
        }
      case R.id.reply:
        {
          mMessageViewFragment.onReply();
          return true;
        }
      case R.id.reply_all:
        {
          mMessageViewFragment.onReplyAll();
          return true;
        }
      case R.id.forward:
        {
          mMessageViewFragment.onForward();
          return true;
        }
      case R.id.share:
        {
          mMessageViewFragment.onSendAlternate();
          return true;
        }
      case R.id.toggle_unread:
        {
          mMessageViewFragment.onToggleRead();
          return true;
        }
      case R.id.archive:
        {
          mMessageViewFragment.onArchive();
          return true;
        }
      case R.id.spam:
        {
          mMessageViewFragment.onSpam();
          return true;
        }
      case R.id.move:
        {
          mMessageViewFragment.onMove();
          return true;
        }
      case R.id.copy:
        {
          mMessageViewFragment.onCopy();
          return true;
        }
      case R.id.select_text:
        {
          mMessageViewFragment.onSelectText();
          return true;
        }
      case R.id.show_headers:
      case R.id.hide_headers:
        {
          mMessageViewFragment.onToggleAllHeadersView();
          updateMenu();
          return true;
        }
    }

    if (!mSingleFolderMode) {
      // None of the options after this point are "safe" for search results
      // TODO: This is not true for "unread" and "starred" searches in regular folders
      return false;
    }

    switch (itemId) {
      case R.id.send_messages:
        {
          mMessageListFragment.onSendPendingMessages();
          return true;
        }
      case R.id.folder_settings:
        {
          if (mFolderName != null) {
            FolderSettings.actionSettings(this, mAccount, mFolderName);
          }
          return true;
        }
      case R.id.expunge:
        {
          mMessageListFragment.onExpunge();
          return true;
        }
      default:
        {
          return super.onOptionsItemSelected(item);
        }
    }
  }
示例#2
0
 @Override
 public boolean onSearchRequested() {
   return mMessageListFragment.onSearchRequested();
 }