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 175f729ce..54565ee11 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -46,8 +46,9 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList newItems.put(curIndex, itemViews[i]) } itemViews = newItems + actMode?.finish() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt index 7296f51d7..f01a50a52 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -43,8 +43,9 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, if (select) { itemViews[pos]?.medium_check?.background?.setColorFilter(primaryColor, PorterDuff.Mode.SRC_IN) selectedPositions.add(pos) - } else + } else { selectedPositions.remove(pos) + } itemViews[pos]?.medium_check?.beVisibleIf(select) @@ -118,10 +119,11 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, var hiddenCnt = 0 var unhiddenCnt = 0 selectedPositions.mapNotNull { media.getOrNull(it) }.forEach { - if (it.name.startsWith('.')) + if (it.name.startsWith('.')) { hiddenCnt++ - else + } else { unhiddenCnt++ + } } menu.findItem(R.id.cab_hide).isVisible = unhiddenCnt > 0 @@ -205,15 +207,15 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, private fun askConfirmDelete() { ConfirmationDialog(activity) { deleteFiles() - actMode?.finish() } } private fun getCurrentFile() = File(media[selectedPositions.first()].path) private fun deleteFiles() { - if (selectedPositions.isEmpty()) + if (selectedPositions.isEmpty()) { return + } val files = ArrayList(selectedPositions.size) val removeMedia = ArrayList(selectedPositions.size)