fix #370, make sure only the proper items are shown in "All media" view
This commit is contained in:
parent
d8811d66b8
commit
64f8d37544
1 changed files with 15 additions and 2 deletions
|
@ -2,7 +2,9 @@ package com.simplemobiletools.gallery.asynctasks
|
|||
|
||||
import android.content.Context
|
||||
import android.os.AsyncTask
|
||||
import com.simplemobiletools.gallery.extensions.config
|
||||
import com.simplemobiletools.gallery.extensions.getFilesFrom
|
||||
import com.simplemobiletools.gallery.extensions.getMediaByDirectories
|
||||
import com.simplemobiletools.gallery.models.Medium
|
||||
import java.util.*
|
||||
|
||||
|
@ -11,8 +13,19 @@ class GetMediaAsynctask(val context: Context, val mPath: String, val isPickVideo
|
|||
AsyncTask<Void, Void, ArrayList<Medium>>() {
|
||||
|
||||
override fun doInBackground(vararg params: Void): ArrayList<Medium> {
|
||||
val path = if (showAll) "" else mPath
|
||||
return context.getFilesFrom(path, isPickImage, isPickVideo)
|
||||
return if (showAll) {
|
||||
val mediaMap = context.getMediaByDirectories(isPickVideo, isPickImage)
|
||||
val media = ArrayList<Medium>()
|
||||
for ((path, curMedia) in mediaMap) {
|
||||
media.addAll(curMedia)
|
||||
}
|
||||
|
||||
Medium.sorting = context.config.getFileSorting("")
|
||||
media.sort()
|
||||
media
|
||||
} else {
|
||||
context.getFilesFrom(mPath, isPickImage, isPickVideo)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPostExecute(media: ArrayList<Medium>) {
|
||||
|
|
Loading…
Reference in a new issue