Пример #1
0
  @Override
  public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
    // TODO Auto-generated method stub

    mode.setTitle("CheckBox is Checked");
    return false;
  }
  /**
   * Select items on view when opened action-mode.
   *
   * @param position The select position.
   */
  private void toggleSelection(int position) {
    mAdp.toggleSelection(position);
    int count = mAdp.getSelectedItemCount();

    if (count == 0) {
      mActionMode.finish();
    } else {
      mActionMode.setTitle(String.valueOf(count));
      mActionMode.invalidate();
    }
  }
Пример #3
0
  /**
   * 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();
    }
  }
  @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;
  }
 private void atualizarTitulo() {
   int checkedCount = qtdeItensMarcados();
   String selecionados =
       getResources().getQuantityString(R.plurals.numero_selecionados, checkedCount, checkedCount);
   mActionMode.setTitle(selecionados);
 }
Пример #6
0
 public void setContextTitle(int count) {
   actionMode.setTitle(getString(R.string.label_selected, count));
 }
 private void updateTitleBar() {
   int total = mAdapter.totalItemChecked();
   String selected = getResources().getQuantityString(R.plurals.total_selected, total, total);
   mActionMode.setTitle(selected);
 }