@SuppressLint("NewApi") @Override public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) { mWrapped.onItemCheckedStateChanged(mode, position, id, checked); if (getCheckedItemCount() == 0) { mode.finish(); } }
/** * This method will be called whenever an item has been checked or unchecked. This will inform * the listener and finish the ActionMode, if the last item has been unchecked. * * @param mode The ActionMode providing the selection mode. * @param position Adapter position of the item that was checked or unchecked. * @param id Adapter ID of the item that was checked or unchecked. * @param checked Whether the item is now checked. */ public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) { listener.onItemCheckedStateChanged(mode, position, id, checked); if (ABSListView.this.getCheckedItemCount() == 0) { mode.finish(); } }