minor code cleanup

This commit is contained in:
tibbi 2017-10-04 19:03:43 +02:00
parent c2ea3ad4bb
commit dd9bef298f

View file

@ -10,14 +10,15 @@ import java.util.*
class GetMediaAsynctask(val context: Context, val mPath: String, val isPickVideo: Boolean = false, val isPickImage: Boolean = false, class GetMediaAsynctask(val context: Context, val mPath: String, val isPickVideo: Boolean = false, val isPickImage: Boolean = false,
val showAll: Boolean, val callback: (media: ArrayList<Medium>) -> Unit) : val showAll: Boolean, val callback: (media: ArrayList<Medium>) -> Unit) :
AsyncTask<Void, Void, ArrayList<Medium>>() { AsyncTask<Void, Void, ArrayList<Medium>>() {
val mediaFetcher = MediaFetcher(context) private val mediaFetcher = MediaFetcher(context)
override fun doInBackground(vararg params: Void): ArrayList<Medium> { override fun doInBackground(vararg params: Void): ArrayList<Medium> {
return if (showAll) { return if (showAll) {
val mediaMap = mediaFetcher.getMediaByDirectories(isPickVideo, isPickImage) val mediaMap = mediaFetcher.getMediaByDirectories(isPickVideo, isPickImage)
val media = ArrayList<Medium>() val media = ArrayList<Medium>()
for ((path, curMedia) in mediaMap) {
media.addAll(curMedia) mediaMap.values.forEach {
media.addAll(it)
} }
Medium.sorting = context.config.getFileSorting("") Medium.sorting = context.config.getFileSorting("")