コード例 #1
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();
    }
  }
コード例 #2
0
  @Override
  public void onListItemClick(ListView l, View v, int position, long id) {
    if (v instanceof ConversationListItem) {
      ConversationListItem headerView = (ConversationListItem) v;
      if (actionMode == null) {
        handleCreateConversation(
            headerView.getThreadId(), headerView.getRecipients(), headerView.getDistributionType());
      } else {
        ConversationListAdapter adapter = (ConversationListAdapter) getListAdapter();
        adapter.toggleThreadInBatchSet(headerView.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();
      }
    }
  }