From c8e104d88da7168cb03153a51e6c9b06710db73e Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 23 Jan 2021 17:36:15 +0100 Subject: [PATCH] fix #403, delete empty folders after move, if really empty --- .../filemanager/pro/adapters/ItemsAdapter.kt | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt index 80e16f06..c09e0484 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt @@ -372,14 +372,28 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList + val sourceFile = File(sourceFileDir.path) + if (activity.getDoesFilePathExist(source) && activity.getIsPathDirectory(source) && + sourceFile.list()?.isEmpty() == true && sourceFile.getProperSize(true) == 0L && sourceFile.getFileCount(true) == 0) { + val sourceFolder = sourceFile.toFileDirItem(activity) + activity.deleteFile(sourceFolder, true) { + listener?.refreshItems() + finishActMode() + } + } + } + } else { + listener?.refreshItems() + finishActMode() + } } } }