Skip to content

'SelectableAdapter.toggleSelection()' doesn't toggle selection in SINGLE mode. #763

@tankpow

Description

@tankpow

I got a use case that clicks item once activates(selects) it and clicks it twice deactivates(deselects) it. But due to the source of 'SelectableAdapter.toggleSelection()':
public void toggleSelection(int position) {
if (position < 0) {
return;
}
if (mMode == SINGLE) {
clearSelection();
}
boolean contains = mSelectedPositions.contains(position);
if (contains) {
removeSelection(position);
} else {
addSelection(position);
}
log.v("toggleSelection %s on position %s, current %s",
(contains ? "removed" : "added"), position, mSelectedPositions);
}
If in SINGLE mode, item in 'position' can only be selected but toggled. I try to override, but many members are 'private' in 'SelectableAdapter' and 'FlexibleAdapter'.

Will toggle selection in SINGLE mode be supported in furture verson by introducing new field member something like 'toggleSelectionInSingleMode'? Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions