diff --git a/app/build.gradle b/app/build.gradle index 2bd80d2e5..0dc4bcb54 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -57,7 +57,7 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.5.2' + implementation 'com.simplemobiletools:commons:5.5.4' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' implementation 'androidx.multidex:multidex:2.0.0' implementation 'it.sephiroth.android.exif:library:1.0.1' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index 20e8a8131..58d81d31c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -497,9 +497,18 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { if (config.useRecycleBin) { val pathsToDelete = ArrayList() + val filter = config.filterMedia + val showHidden = config.shouldShowHidden fileDirItems.filter { it.isDirectory }.forEach { val files = File(it.path).listFiles() - files?.filter { it.absolutePath.isMediaFile() }?.mapTo(pathsToDelete) { it.absolutePath } + files?.filter { + it.absolutePath.isMediaFile() && (showHidden || !it.name.startsWith('.')) && + ((it.isImageFast() && filter and TYPE_IMAGES != 0) || + (it.isVideoFast() && filter and TYPE_VIDEOS != 0) || + (it.isGif() && filter and TYPE_GIFS != 0) || + (it.isRawFast() && filter and TYPE_RAWS != 0) || + (it.isSvg() && filter and TYPE_SVGS != 0)) + }?.mapTo(pathsToDelete) { it.absolutePath } } movePathsInRecycleBin(pathsToDelete, mMediumDao) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt index 30c358160..b4241f18e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt @@ -323,8 +323,15 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList { val paths = ArrayList() - activity.getOTGFolderChildren(path)?.forEach { - if (!it.isDirectory && it.name!!.isMediaFile() && (showHidden || !it.name!!.startsWith('.'))) { + val filter = config.filterMedia + activity.getOTGFolderChildren(path)?.filter { it.name != null }?.forEach { + if (!it.isDirectory && + it.name!!.isMediaFile() && (showHidden || !it.name!!.startsWith('.')) && + ((it.name!!.isImageFast() && filter and TYPE_IMAGES != 0) || + (it.name!!.isVideoFast() && filter and TYPE_VIDEOS != 0) || + (it.name!!.isGif() && filter and TYPE_GIFS != 0) || + (it.name!!.isRawFast() && filter and TYPE_RAWS != 0) || + (it.name!!.isSvg() && filter and TYPE_SVGS != 0)) + ) { val relativePath = it.uri.path.substringAfterLast("${activity.config.OTGPartition}:") paths.add("$OTG_PATH$relativePath") }