public Boolean onClick ( AppCompatActivity act , IItem item ) { //if we are current in CAB mode, and we remove the last selection, we want to finish the actionMode if ( mActionMode != null && ( mSelectExtension . getSelectedItems ( ) . size ( ) == 1 ) && item . isSelected ( ) ) { mActionMode . finish ( ) ; mSelectExtension . deselect ( ) ; return true ; } if ( mActionMode != null ) { // calculate the selection count for the action mode // because current selection is not reflecting the future state yet! int selected = mSelectExtension . getSelectedItems ( ) . size ( ) ; if ( item . isSelected ( ) ) selected -- ; else if ( item . isSelectable ( ) ) selected ++ ; checkActionMode ( act , selected ) ; } return null ; }
implements the basic behavior of a CAB and multi select behavior including logics if the clicked item is collapsible