@Override
  public Integer buildFilter(Account account) {
    if (!Account.isNormalAccount(account.mId)) {
      // Shortcuts for combined accounts can only be for inboxes.
      return MailboxShortcutPickerFragment.FILTER_INBOX_ONLY;
    }

    return MailboxShortcutPickerFragment.FILTER_ALLOW_ALL;
  }
 @Override
 public void onSelected(Account account, long mailboxId) {
   String shortcutName;
   /* M: Get display name from FolderProperty, not from database.
    * Aiming to accomplish multi-language.*/
   Mailbox mailbox = Mailbox.restoreMailboxWithId(this, mailboxId);
   if (Account.isNormalAccount(account.mId) && (mailbox.mType != Mailbox.TYPE_INBOX)) {
     shortcutName = FolderProperties.getInstance(this).getDisplayName(mailbox);
   } else {
     shortcutName = account.getDisplayName();
   }
   setupShortcut(account, mailboxId, shortcutName);
   finish();
 }
  /**
   * Create an intent to launch search activity.
   *
   * @param accountId ID of the account for the mailbox. Must not be {@link Account#NO_ACCOUNT}.
   * @param mailboxId ID of the mailbox to search, or {@link Mailbox#NO_MAILBOX} to perform global
   *     search.
   * @param query query string.
   */
  public static Intent createSearchIntent(
      Activity fromActivity, long accountId, long mailboxId, String query) {
    Preconditions.checkArgument(
        Account.isNormalAccount(accountId), "Can only search in normal accounts");

    // Note that a search doesn't use a restart intent, as we want another instance of
    // the activity to sit on the stack for search.
    Intent i = new Intent(fromActivity, EmailActivity.class);
    i.putExtra(EXTRA_ACCOUNT_ID, accountId);
    i.putExtra(EXTRA_MAILBOX_ID, mailboxId);
    i.putExtra(EXTRA_QUERY_STRING, query);
    i.setAction(Intent.ACTION_SEARCH);
    return i;
  }