From d2e2e315e123bb86f0095736efb37f9dfb716342 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 26 Apr 2018 10:35:32 +0200 Subject: [PATCH] make sure we filter out empty folders --- .../simplemobiletools/gallery/activities/MainActivity.kt | 6 ++++++ 1 file changed, 6 insertions(+) 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 a6fec1db6..a0a4e3984 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -759,6 +759,12 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { dirs.forEach { if (!getDoesFilePathExist(it.path)) { invalidDirs.add(it) + } else { + val children = File(it.path).list() + val hasMediaFile = children?.any { it.isImageVideoGif() } ?: false + if (!hasMediaFile) { + invalidDirs.add(it) + } } }