diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt index 2c99f54d6..a3b8a2b5d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt @@ -10,14 +10,15 @@ import java.util.* class GetMediaAsynctask(val context: Context, val mPath: String, val isPickVideo: Boolean = false, val isPickImage: Boolean = false, val showAll: Boolean, val callback: (media: ArrayList) -> Unit) : AsyncTask>() { - val mediaFetcher = MediaFetcher(context) + private val mediaFetcher = MediaFetcher(context) override fun doInBackground(vararg params: Void): ArrayList { return if (showAll) { val mediaMap = mediaFetcher.getMediaByDirectories(isPickVideo, isPickImage) val media = ArrayList() - for ((path, curMedia) in mediaMap) { - media.addAll(curMedia) + + mediaMap.values.forEach { + media.addAll(it) } Medium.sorting = context.config.getFileSorting("")