try using adapterPosition instead of layoutPosition in recyclerView adapters
This commit is contained in:
parent
16eb8cde3f
commit
73bcad0f68
2 changed files with 8 additions and 8 deletions
|
@ -420,8 +420,8 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList<Direc
|
||||||
|
|
||||||
private fun viewClicked(directory: Directory) {
|
private fun viewClicked(directory: Directory) {
|
||||||
if (multiSelector.isSelectable) {
|
if (multiSelector.isSelectable) {
|
||||||
val isSelected = adapterListener.getSelectedPositions().contains(layoutPosition)
|
val isSelected = adapterListener.getSelectedPositions().contains(adapterPosition)
|
||||||
adapterListener.toggleItemSelectionAdapter(!isSelected, layoutPosition)
|
adapterListener.toggleItemSelectionAdapter(!isSelected, adapterPosition)
|
||||||
} else {
|
} else {
|
||||||
itemClick(directory)
|
itemClick(directory)
|
||||||
}
|
}
|
||||||
|
@ -431,10 +431,10 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList<Direc
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
if (!multiSelector.isSelectable) {
|
if (!multiSelector.isSelectable) {
|
||||||
activity.startSupportActionMode(multiSelectorCallback)
|
activity.startSupportActionMode(multiSelectorCallback)
|
||||||
adapterListener.toggleItemSelectionAdapter(true, layoutPosition)
|
adapterListener.toggleItemSelectionAdapter(true, adapterPosition)
|
||||||
}
|
}
|
||||||
|
|
||||||
listener.itemLongClicked(layoutPosition)
|
listener.itemLongClicked(adapterPosition)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -335,8 +335,8 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
|
||||||
|
|
||||||
private fun viewClicked(medium: Medium) {
|
private fun viewClicked(medium: Medium) {
|
||||||
if (multiSelector.isSelectable) {
|
if (multiSelector.isSelectable) {
|
||||||
val isSelected = adapterListener.getSelectedPositions().contains(layoutPosition)
|
val isSelected = adapterListener.getSelectedPositions().contains(adapterPosition)
|
||||||
adapterListener.toggleItemSelectionAdapter(!isSelected, layoutPosition)
|
adapterListener.toggleItemSelectionAdapter(!isSelected, adapterPosition)
|
||||||
} else {
|
} else {
|
||||||
itemClick(medium)
|
itemClick(medium)
|
||||||
}
|
}
|
||||||
|
@ -346,10 +346,10 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
if (!multiSelector.isSelectable) {
|
if (!multiSelector.isSelectable) {
|
||||||
activity.startSupportActionMode(multiSelectorCallback)
|
activity.startSupportActionMode(multiSelectorCallback)
|
||||||
adapterListener.toggleItemSelectionAdapter(true, layoutPosition)
|
adapterListener.toggleItemSelectionAdapter(true, adapterPosition)
|
||||||
}
|
}
|
||||||
|
|
||||||
listener.itemLongClicked(layoutPosition)
|
listener.itemLongClicked(adapterPosition)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue