mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-06-05 21:59:19 +02:00
properly look for empty OTG folders too
This commit is contained in:
@@ -760,7 +760,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||||||
if (!getDoesFilePathExist(it.path)) {
|
if (!getDoesFilePathExist(it.path)) {
|
||||||
invalidDirs.add(it)
|
invalidDirs.add(it)
|
||||||
} else {
|
} else {
|
||||||
val children = File(it.path).list()
|
val children = if (it.path.startsWith(OTG_PATH)) getOTGFolderChildren(it.path) else File(it.path).list()?.asList()
|
||||||
val hasMediaFile = children?.any { it.isImageVideoGif() } ?: false
|
val hasMediaFile = children?.any { it.isImageVideoGif() } ?: false
|
||||||
if (!hasMediaFile) {
|
if (!hasMediaFile) {
|
||||||
invalidDirs.add(it)
|
invalidDirs.add(it)
|
||||||
@@ -777,6 +777,8 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getOTGFolderChildren(path: String) = getDocumentFile(path)?.listFiles()?.map { it.name }?.toList()
|
||||||
|
|
||||||
private fun getCurrentlyDisplayedDirs() = getRecyclerAdapter()?.dirs ?: ArrayList()
|
private fun getCurrentlyDisplayedDirs() = getRecyclerAdapter()?.dirs ?: ArrayList()
|
||||||
|
|
||||||
private fun getBubbleTextItem(index: Int) = getRecyclerAdapter()?.dirs?.getOrNull(index)?.getBubbleText() ?: ""
|
private fun getBubbleTextItem(index: Int) = getRecyclerAdapter()?.dirs?.getOrNull(index)?.getBubbleText() ?: ""
|
||||||
|
Reference in New Issue
Block a user