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 805434399..9b803b21c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -42,10 +42,7 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList() fun toggleItemSelection(itemView: View, select: Boolean, pos: Int = -1) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) - itemView.dir_frame.isSelected = select - else - itemView.dir_thumbnail.isSelected = select + getProperView(itemView).isSelected = select if (pos == -1) return @@ -55,6 +52,13 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList, val markedItems = HashSet() fun toggleItemSelection(itemView: View, select: Boolean, pos: Int = -1) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) - itemView.medium_thumbnail_holder.isSelected = select - else - itemView.medium_thumbnail.isSelected = select + getProperView(itemView).isSelected = select if (pos == -1) return @@ -55,6 +52,13 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, else markedItems.remove(pos) } + + fun getProperView(itemView: View): View { + return if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) + itemView.medium_thumbnail_holder + else + itemView.medium_thumbnail + } } val multiSelectorMode = object : ModalMultiSelectorCallback(multiSelector) {