mirror of
https://github.com/SimpleMobileTools/Simple-App-Launcher.git
synced 2025-02-01 01:46:44 +01:00
allow deselecting items too
This commit is contained in:
parent
8e0bfee651
commit
a4eddc347b
@ -63,8 +63,15 @@ class RecyclerAdapter(val act: Activity, val launchers: List<AppLauncher>, val i
|
|||||||
itemView.launcher_label.text = launcher.name
|
itemView.launcher_label.text = launcher.name
|
||||||
itemView.setOnClickListener {
|
itemView.setOnClickListener {
|
||||||
if (multiSelector.isSelectable) {
|
if (multiSelector.isSelectable) {
|
||||||
multiSelector.setSelected(viewHolder, true)
|
val isSelected = multiSelector.selectedPositions.contains(viewHolder.layoutPosition)
|
||||||
actMode?.title = multiSelector.selectedPositions.size.toString()
|
multiSelector.setSelected(viewHolder, !isSelected)
|
||||||
|
|
||||||
|
val selectedCnt = multiSelector.selectedPositions.size
|
||||||
|
if (selectedCnt == 0) {
|
||||||
|
actMode?.finish()
|
||||||
|
} else {
|
||||||
|
actMode?.title = selectedCnt.toString()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
itemClick(this)
|
itemClick(this)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user