use adapterPosition at the ItemsAdapter

This commit is contained in:
tibbi 2017-10-02 23:25:06 +02:00
parent a4129f1a14
commit 5645bfc9d6

View file

@ -525,8 +525,8 @@ class ItemsAdapter(val activity: SimpleActivity, var mItems: MutableList<FileDir
private fun viewClicked(fileDirItem: FileDirItem) {
if (multiSelector.isSelectable) {
val isSelected = adapterListener.getSelectedPositions().contains(layoutPosition)
adapterListener.toggleItemSelectionAdapter(!isSelected, layoutPosition)
val isSelected = adapterListener.getSelectedPositions().contains(adapterPosition)
adapterListener.toggleItemSelectionAdapter(!isSelected, adapterPosition)
} else {
itemClick(fileDirItem)
}
@ -536,10 +536,10 @@ class ItemsAdapter(val activity: SimpleActivity, var mItems: MutableList<FileDir
if (listener != null) {
if (!multiSelector.isSelectable) {
activity.startSupportActionMode(multiSelectorCallback)
adapterListener.toggleItemSelectionAdapter(true, layoutPosition)
adapterListener.toggleItemSelectionAdapter(true, adapterPosition)
}
listener.itemLongClicked(layoutPosition)
listener.itemLongClicked(adapterPosition)
}
}