From 311d28242fa1c0e0b1a7893e60e3c175e8271f6a Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 14 May 2017 17:29:02 +0200 Subject: [PATCH] set image select state only after its already init --- .../simplemobiletools/gallery/adapters/DirectoryAdapter.kt | 4 ++-- .../com/simplemobiletools/gallery/adapters/MediaAdapter.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 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 f275910cd..e024a3472 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -312,6 +312,7 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList, override fun onBindViewHolder(holder: ViewHolder, position: Int) { itemViews.put(position, holder.bindView(activity, multiSelectorMode, multiSelector, media[position], position, listener, displayFilenames)) + toggleItemSelection(selectedPositions.contains(position), position) holder.itemView.tag = holder } @@ -315,7 +316,6 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, play_outline.visibility = if (medium.video) View.VISIBLE else View.GONE photo_name.beVisibleIf(displayFilenames) photo_name.text = medium.name - adapter.toggleItemSelectionAdapter(adapter.getSelectedPositions().contains(pos), pos) activity.loadImage(medium.path, medium_thumbnail) setOnClickListener { viewClicked(multiSelector, medium, pos) } @@ -338,7 +338,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, fun viewClicked(multiSelector: MultiSelector, medium: Medium, pos: Int) { if (multiSelector.isSelectable) { - val isSelected = adapter.getSelectedPositions().contains(layoutPosition) + val isSelected = adapter.getSelectedPositions().contains(pos) adapter.toggleItemSelectionAdapter(!isSelected, pos) } else { itemClick(medium)