store fetched media in db right after getting folders

This commit is contained in:
tibbi 2018-04-23 16:16:46 +02:00
parent a4f62ffcd9
commit 64fe17d1b9

View File

@ -10,6 +10,7 @@ import com.simplemobiletools.commons.helpers.sumByLong
import com.simplemobiletools.gallery.R
import com.simplemobiletools.gallery.extensions.checkAppendingHidden
import com.simplemobiletools.gallery.extensions.config
import com.simplemobiletools.gallery.extensions.galleryDB
import com.simplemobiletools.gallery.extensions.getDirMediaTypes
import com.simplemobiletools.gallery.helpers.MediaFetcher
import com.simplemobiletools.gallery.models.Directory
@ -45,6 +46,7 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
File(firstItem.path).parent
} ?: continue
context.galleryDB.MediumDao().insertAll(curMedia)
var thumbnail = curMedia.firstOrNull { context.getDoesFilePathExist(it.path) }?.path ?: ""
if (thumbnail.startsWith(OTG_PATH)) {
thumbnail = thumbnail.getOTGPublicPath(context)