mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 00:17:58 +01:00
fix #722, show hidden files only when appropriate
This commit is contained in:
parent
91f1efac31
commit
842df6b54c
1 changed files with 14 additions and 3 deletions
|
@ -203,8 +203,10 @@ class MediaFetcher(val context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getMediaInFolder(folder: String, curMedia: ArrayList<Medium>, isPickImage: Boolean, isPickVideo: Boolean, filterMedia: Int) {
|
private fun getMediaInFolder(folder: String, curMedia: ArrayList<Medium>, isPickImage: Boolean, isPickVideo: Boolean, filterMedia: Int) {
|
||||||
val doExtraCheck = context.config.doExtraCheck
|
|
||||||
val files = File(folder).listFiles() ?: return
|
val files = File(folder).listFiles() ?: return
|
||||||
|
val doExtraCheck = context.config.doExtraCheck
|
||||||
|
val showHidden = context.config.shouldShowHidden
|
||||||
|
|
||||||
for (file in files) {
|
for (file in files) {
|
||||||
if (shouldStop) {
|
if (shouldStop) {
|
||||||
break
|
break
|
||||||
|
@ -227,6 +229,9 @@ class MediaFetcher(val context: Context) {
|
||||||
if (isGif && filterMedia and GIFS == 0)
|
if (isGif && filterMedia and GIFS == 0)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if (!showHidden && filename.startsWith('.'))
|
||||||
|
continue
|
||||||
|
|
||||||
val size = file.length()
|
val size = file.length()
|
||||||
if (size <= 0L || (doExtraCheck && !file.exists()))
|
if (size <= 0L || (doExtraCheck && !file.exists()))
|
||||||
continue
|
continue
|
||||||
|
@ -247,9 +252,12 @@ class MediaFetcher(val context: Context) {
|
||||||
|
|
||||||
private fun getMediaOnOTG(folder: String, curMedia: ArrayList<Medium>, isPickImage: Boolean, isPickVideo: Boolean, filterMedia: Int) {
|
private fun getMediaOnOTG(folder: String, curMedia: ArrayList<Medium>, isPickImage: Boolean, isPickVideo: Boolean, filterMedia: Int) {
|
||||||
val files = context.getDocumentFile(folder)?.listFiles() ?: return
|
val files = context.getDocumentFile(folder)?.listFiles() ?: return
|
||||||
|
val doExtraCheck = context.config.doExtraCheck
|
||||||
|
val showHidden = context.config.shouldShowHidden
|
||||||
|
|
||||||
for (file in files) {
|
for (file in files) {
|
||||||
if (shouldStop) {
|
if (shouldStop) {
|
||||||
return
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
val filename = file.name
|
val filename = file.name
|
||||||
|
@ -269,8 +277,11 @@ class MediaFetcher(val context: Context) {
|
||||||
if (isGif && filterMedia and GIFS == 0)
|
if (isGif && filterMedia and GIFS == 0)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if (!showHidden && filename.startsWith('.'))
|
||||||
|
continue
|
||||||
|
|
||||||
val size = file.length()
|
val size = file.length()
|
||||||
if (size <= 0L && !file.exists())
|
if (size <= 0L || (doExtraCheck && !file.exists()))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
val dateTaken = file.lastModified()
|
val dateTaken = file.lastModified()
|
||||||
|
|
Loading…
Reference in a new issue