From d2546e1a3eb1076fcacc2e6af0c8ffe0a4d8dd5b Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 12 Nov 2016 20:34:21 +0100 Subject: [PATCH] delete only media files at deleting a folder --- app/src/main/java/com/simplemobiletools/gallery/Utils.kt | 2 ++ .../com/simplemobiletools/gallery/activities/MainActivity.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/simplemobiletools/gallery/Utils.kt b/app/src/main/java/com/simplemobiletools/gallery/Utils.kt index 30bb0b592..7a9905428 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/Utils.kt +++ b/app/src/main/java/com/simplemobiletools/gallery/Utils.kt @@ -132,6 +132,8 @@ class Utils { } } + fun isPhotoVideo(file: File) = file.isPhotoVideo() + fun needsStupidWritePermissions(context: Context, path: String) = context.needsStupidWritePermissions(path) fun getFileDocument(context: Context, path: String, treeUri: String) = context.getFileDocument(path, treeUri) diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java index ed8d2f51c..de44d693f 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java @@ -235,7 +235,7 @@ public class MainActivity extends SimpleActivity if (dir.exists()) { final File[] files = dir.listFiles(); for (File file : files) { - if (file.isFile()) { + if (file.isFile() && Utils.Companion.isPhotoVideo(file)) { updatedFiles.add(file); deleteItem(file); }