From 8108a109dcdaafa22499a0985d1be5daf9027ef3 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 10 Nov 2016 18:57:09 +0100 Subject: [PATCH] fix #50, make sure we have SD write permission before deleting a folder --- .../simplemobiletools/gallery/activities/MainActivity.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 1f4264aad..fe10e0d9c 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java @@ -255,8 +255,10 @@ public class MainActivity extends SimpleActivity private void deleteItem(File file) { if (Utils.Companion.needsStupidWritePermissions(this, file.getAbsolutePath())) { - final DocumentFile document = Utils.Companion.getFileDocument(this, file.getAbsolutePath()); - document.delete(); + if (!Utils.Companion.isShowingWritePermissions(this, new File(file.getAbsolutePath()))) { + final DocumentFile document = Utils.Companion.getFileDocument(this, file.getAbsolutePath()); + document.delete(); + } } else { file.delete(); }