コード例 #1
0
 private void handleSelectAllThreads() {
   getListAdapter().selectAllThreads();
   actionMode.setSubtitle(
       getString(
           R.string.conversation_fragment_cab__batch_selection_amount,
           ((ConversationListAdapter) this.getListAdapter()).getBatchSelections().size()));
 }
コード例 #2
0
  @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;
  }
コード例 #3
0
  @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();
    }
  }