예제 #1
0
파일: Chat.java 프로젝트: acruche/DobleFC
  /**
   * Toggle the selection state of an item.
   *
   * <p>If the item was the last one in the selection and is unselected, the selection is stopped.
   * Note that the selection must already be started (actionMode must not be null).
   *
   * @param position Position of the item to toggle the selection state
   */
  private void toggleSelection(int position) {
    chatAdapter.toggleSelection(position);
    int count = chatAdapter.getSelectedItemCount();

    if (count == 0) {
      actionMode.finish();
    } else {
      actionMode.setTitle(String.valueOf(count));
      actionMode.invalidate();
    }
  }