From dd47759014da9bc904287cdc151effd0426b1939 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 19 Nov 2016 22:06:02 +0100 Subject: [PATCH] allow deleting only photo and video files with the gallery --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 2 +- .../com/simplemobiletools/gallery/activities/MediaActivity.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index 1430d9166..63b84ebdf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -184,7 +184,7 @@ class MainActivity : SimpleActivity(), GetDirectoriesAsynctask.GetDirectoriesLis for (delPath in mToBeDeleted) { val dir = File(delPath) if (dir.exists()) { - val files = dir.listFiles() + val files = dir.listFiles().filter(File::isPhotoVideo) files.forEach { if (it.isFile && it.isPhotoVideo()) { updatedFiles.add(it) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index ab2798df5..dd7d1953c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -230,7 +230,7 @@ class MediaActivity : SimpleActivity(), View.OnTouchListener, MediaAdapter.Media for (delPath in mToBeDeleted) { val file = File(delPath) - if (file.exists()) { + if (file.exists() && file.isPhotoVideo()) { if (needsStupidWritePermissions(delPath)) { if (isShowingPermDialog(file)) return