mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-22 20:48:00 +01:00
show hidden files only when should
This commit is contained in:
parent
27becd9247
commit
f137f3db06
2 changed files with 8 additions and 1 deletions
|
@ -18,6 +18,7 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
|
|||
val callback: (dirs: ArrayList<Directory>) -> Unit) : AsyncTask<Void, Void, ArrayList<Directory>>() {
|
||||
var config = context.config
|
||||
var shouldStop = false
|
||||
val showHidden = config.shouldShowHidden
|
||||
|
||||
override fun doInBackground(vararg params: Void): ArrayList<Directory> {
|
||||
if (!context.hasWriteStoragePermission())
|
||||
|
@ -48,6 +49,9 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
|
|||
if (isImage && (isPickVideo || showMedia == VIDEOS))
|
||||
continue
|
||||
|
||||
if (!showHidden && filename.startsWith('.'))
|
||||
continue
|
||||
|
||||
val file = File(it, filename)
|
||||
val size = file.length()
|
||||
if (size == 0L)
|
||||
|
@ -74,7 +78,6 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
|
|||
private fun groupDirectories(media: ArrayList<Medium>): Map<String, Directory> {
|
||||
val hidden = context.resources.getString(R.string.hidden)
|
||||
val directories = LinkedHashMap<String, Directory>()
|
||||
val showHidden = config.shouldShowHidden
|
||||
for ((name, path, isVideo, dateModified, dateTaken, size) in media) {
|
||||
if (shouldStop)
|
||||
cancel(true)
|
||||
|
|
|
@ -22,6 +22,7 @@ class GetMediaAsynctask(val context: Context, val mPath: String, val isPickVideo
|
|||
var fileSorting = 0
|
||||
var shouldStop = false
|
||||
var media = ArrayList<Medium>()
|
||||
val showHidden = config.shouldShowHidden
|
||||
|
||||
override fun onPreExecute() {
|
||||
super.onPreExecute()
|
||||
|
@ -63,6 +64,9 @@ class GetMediaAsynctask(val context: Context, val mPath: String, val isPickVideo
|
|||
if (isImage && (isPickVideo || showMedia == VIDEOS))
|
||||
continue
|
||||
|
||||
if (!showHidden && filename.startsWith('.'))
|
||||
continue
|
||||
|
||||
val file = File(path, filename)
|
||||
val size = file.length()
|
||||
if (size == 0L)
|
||||
|
|
Loading…
Reference in a new issue