From 73bcad0f682fdb16b0a105a8c285c91a41edb691 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 30 Sep 2017 20:24:18 +0200 Subject: [PATCH] try using adapterPosition instead of layoutPosition in recyclerView adapters --- .../gallery/adapters/DirectoryAdapter.kt | 8 ++++---- .../simplemobiletools/gallery/adapters/MediaAdapter.kt | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 875115514..6c6077fab 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -420,8 +420,8 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList, private fun viewClicked(medium: Medium) { 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(medium) } @@ -346,10 +346,10 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, if (listener != null) { if (!multiSelector.isSelectable) { activity.startSupportActionMode(multiSelectorCallback) - adapterListener.toggleItemSelectionAdapter(true, layoutPosition) + adapterListener.toggleItemSelectionAdapter(true, adapterPosition) } - listener.itemLongClicked(layoutPosition) + listener.itemLongClicked(adapterPosition) } }