private void handleSelectAllThreads() {
   getListAdapter().selectAllThreads();
   actionMode.setSubtitle(
       getString(
           R.string.conversation_fragment_cab__batch_selection_amount,
           ((ConversationListAdapter) this.getListAdapter()).getBatchSelections().size()));
 }
  @Override
  public boolean onCreateActionMode(ActionMode mode, Menu menu) {
    MenuInflater inflater = getActivity().getMenuInflater();
    inflater.inflate(R.menu.conversation_list_batch, menu);

    mode.setTitle(R.string.conversation_fragment_cab__batch_selection_mode);
    mode.setSubtitle(null);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      getActivity()
          .getWindow()
          .setStatusBarColor(getResources().getColor(R.color.action_mode_status_bar));
    }

    return true;
  }
  @Override
  public void onItemClick(ConversationListItem item) {
    if (actionMode == null) {
      handleCreateConversation(
          item.getThreadId(), item.getRecipients(), item.getDistributionType());
    } else {
      ConversationListAdapter adapter = (ConversationListAdapter) list.getAdapter();
      adapter.toggleThreadInBatchSet(item.getThreadId());

      if (adapter.getBatchSelections().size() == 0) {
        actionMode.finish();
      } else {
        actionMode.setSubtitle(
            getString(
                R.string.conversation_fragment_cab__batch_selection_amount,
                adapter.getBatchSelections().size()));
      }

      adapter.notifyDataSetChanged();
    }
  }