mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
properly look for empty OTG folders too
This commit is contained in:
parent
617412a3bc
commit
be54d59bd0
1 changed files with 3 additions and 1 deletions
|
@ -760,7 +760,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
if (!getDoesFilePathExist(it.path)) {
|
||||
invalidDirs.add(it)
|
||||
} 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
|
||||
if (!hasMediaFile) {
|
||||
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 getBubbleTextItem(index: Int) = getRecyclerAdapter()?.dirs?.getOrNull(index)?.getBubbleText() ?: ""
|
||||
|
|
Loading…
Reference in a new issue