@Override
    public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
      // TODO Auto-generated method stub
      int selectCount = img_grid.getCheckedItemCount();
      switch (selectCount) {
        case 1:
          mode.setTitle("" + selectCount);
          break;
        default:
          mode.setTitle("" + selectCount);
          break;
      }

      if (checked) {
        adapter.addSelection(position);
      } else {
        int count = adapter.getSelectedCount();
        for (int i = 0; i < count; i++) {
          if (adapter.getSelected(i) == position) adapter.removeSelection(i);
        }

        //                ArrayList<Integer> indexes = adapter.getSelecteds();
        //                for (Integer i : indexes ) {
        //                    adapter.removeSelection(i);
        //                }
      }
    }
Example #2
0
 @Override
 public void onItemLongClickListener(View view, int position) {
   if (selectedApps.get(position) == null) {
     selectedApps.put(position, adapter.getModelList().get(position));
     adapter.setItemChecked(position, true);
   } else {
     selectedApps.remove(position);
     adapter.setItemChecked(position, false);
   }
   if (selectedApps.size() != 0) {
     if (actionMode == null) {
       actionMode = toolbar.startActionMode(this);
       AppHelper.actionModeColor(this);
     }
     if (selectedApps.size() > 1) {
       actionMode.setTitle("Backup ( " + selectedApps.size() + " Apps )");
     } else {
       actionMode.setTitle("Backup ( " + selectedApps.size() + " App )");
     }
     enableDisableMenuItem(false);
   } else {
     actionMode.finish();
     actionMode = null;
   }
 }
 /** ** Contextual ActionBar (CAB) routines * */
 private void updateActionModeTitle() {
   if (mActionMode == null) return;
   int numSelected = getSelectedCommentCount();
   if (numSelected > 0) {
     mActionMode.setTitle(Integer.toString(numSelected));
   } else {
     mActionMode.setTitle("");
   }
 }
        public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
          actionMode.setTitle(R.string.photo_selection_cab_title);

          MenuInflater inflater = getActivity().getMenuInflater();
          inflater.inflate(R.menu.photo_context_menu, menu);
          return true;
        }
 @Override
 public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
   // TODO Auto-generated method stub
   String name = (String) soccerData.getItem(position).get("name");
   mode.setTitle(name);
   return false;
 }
 @Override
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   MenuInflater inflater = mode.getMenuInflater();
   inflater.inflate(R.menu.cab_jsonarray, menu);
   mode.setTitle(mCheckedCount + getString(R.string.desc_selected));
   return true;
 }
 @Override
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   mode.setTitle(null);
   mode.setSubtitle(null);
   mEditable = mActionHandler.isSelectionEditable();
   createActionMenu(mode, menu);
   return true;
 }
Example #8
0
 public static void updateActionModeTitle(ActionMode mode, Context context, int selectedNum) {
   if (mode != null) {
     mode.setTitle(context.getString(R.string.multi_select_title, selectedNum));
     if (selectedNum == 0) {
       mode.finish();
     }
   }
 }
 @Override
 public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
   mode.setTitle(
       String.format(
           getString(R.string.have_selected),
           String.valueOf(getListView().getCheckedItemCount())));
   adapter.notifyDataSetChanged();
 }
Example #10
0
 private void updateActionModeTitle() {
   if (mActionMode != null) {
     int num = getSelectedCount();
     String str = getResources().getString(R.string.selected_count);
     str = String.format(str, num);
     mActionMode.setTitle(str);
   }
 }
Example #11
0
  @Override
  public boolean onCreateActionMode(ActionMode mode, Menu menu) {
    MenuInflater inflater = host.getMenuInflater();

    inflater.inflate(R.menu.context, menu);
    mode.setTitle(R.string.context_title);

    return (true);
  }
 @Override
 public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
   if (checked) {
     ++mCheckedCount;
   } else {
     --mCheckedCount;
   }
   mode.setTitle(mCheckedCount + getString(R.string.desc_selected));
 }
 @Override
 public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
   if (checked) {
     mCheckedItems.add(getListAdapter().getItem(position));
   } else {
     mCheckedItems.remove(getListAdapter().getItem(position));
   }
   mode.setTitle(mCheckedItems.size() + getString(R.string.desc_selected));
 }
 @Override
 public void onItemCheckedStateChanged(
     ActionMode mode, int position, long id, boolean checked) {
   // Get the total of checked items
   final int checkedCount = list.getCheckedItemCount();
   // Set the CAB title according to total checked items
   mode.setTitle(checkedCount + getString(R.string.selected_postfix));
   // Call to the toggle method of the adapter
   adapter.toggleSelection(position);
 }
 // Cambia el estado de selección del elemento situado en dicha posición.
 private void toggleSelection(int position) {
   // Se cambia el estado de selección
   mAdaptador.toggleSelection(position);
   // Se actualiza el texto del action mode contextual.
   mActionMode.setTitle(mAdaptador.getSelectedItemCount() + " / " + mAdaptador.getItemCount());
   // Si ya no hay ningún elemento seleccionado se finaliza el modo de
   // acción contextual
   if (mAdaptador.getSelectedItemCount() == 0) {
     mActionMode.finish();
   }
 }
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
          if (actionMode == null) {
            actionMode = ImageSelectActivity.this.startActionMode(callback);
          }
          toggleSelection(position);
          actionMode.setTitle(countSelected + " " + getString(R.string.selected));

          if (countSelected == 0) {
            actionMode.finish();
          }
        }
  private void updateActionModeTitle() {
    String title =
        adapter.getAmountOfCheckedItems()
            + " "
            + getActivity()
                .getResources()
                .getQuantityString(
                    R.plurals.formula_editor_variable_context_action_item_selected,
                    adapter.getAmountOfCheckedItems());

    contextActionMode.setTitle(title);
  }
  @Override
  public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
    // Here you can do something when items are selected/de-selected,
    // such as update the title in the CAB

    if (checked) {
      selection.add(Long.valueOf(id));
    } else {
      selection.remove(Long.valueOf(id));
    }

    mode.setTitle("" + selection.size());
  }
 @Override
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   adapter.setSelectMode(ListView.CHOICE_MODE_MULTIPLE);
   adapter.notifyDataSetChanged();
   mode.setTitle(
       "0 "
           + getActivity()
               .getResources()
               .getQuantityString(
                   R.plurals.formula_editor_variable_context_action_item_selected, 0));
   getActivity().findViewById(R.id.bottom_bar).setVisibility(View.GONE);
   addSelectAllActionModeButton(mode, menu);
   return true;
 }
Example #20
0
 public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
   if (titleChanged) {
     titleChanged = false;
     mode.setTitle(Utility.evalValue(mTitleObservable, CharSequence.class));
   }
   if (invalidated) {
     invalidated = false;
     for (AbsMenuBridge item : items.values()) {
       item.onPrepareOptionItem(menu);
     }
     return true;
   }
   return false;
 }
  @Override
  public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
    MenuInflater inflater = mode.getMenuInflater();
    menu.clear();

    // sina weibo has bug,everyone's following is false
    inflater.inflate(R.menu.contextual_menu_fragment_user_listview, menu);
    //        if(bean.isFollowing()){
    //           menu.findItem(R.id.menu_follow).setVisible(false);
    //        }

    mode.setTitle(bean.getScreen_name());

    return true;
  }
Example #22
0
 @Override
 public void setTitle(CharSequence title) {
   mActionMode.setTitle(title);
 }
 private void setTitle(ActionMode mode) {
   int count = contactList.getCheckedItemCount();
   mode.setTitle(
       count + " " + getResources().getString(count > 1 ? R.string.contacts : R.string.contact));
   ((ContactAdapter) contactList.getAdapter()).notifyDataSetChanged();
 }
 private void updateTitle(final ActionMode mode) {
   final ListView listView = getListView();
   if (listView == null || mode == null || getActivity() == null) return;
   final int count = listView.getCheckedItemCount();
   mode.setTitle(getResources().getQuantityString(R.plurals.Nitems_selected, count, count));
 }
 public void setTitle(int i) {
   mWrappedObject.setTitle(i);
 }
 @Override
 protected void setActionModeTitle(String title) {
   actionMode.setTitle(title);
 }
Example #27
0
 @Override
 public void setTitle(int resId) {
   mActionMode.setTitle(resId);
 }
 // Called when the action mode is created; startActionMode() was called
 @Override
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   mode.setTitle("Remove Item");
   mode.getMenuInflater().inflate(R.menu.menu_item, menu);
   return true;
 }
 private void toggleSelection(int position) {
   simpleRecyclerViewAdapter.toggleSelection(position);
   actionMode.setTitle("Selected " + "1");
 }
 public void setTitle(CharSequence charsequence) {
   mWrappedObject.setTitle(charsequence);
 }