From 64fe17d1b95ab4b1b9edfc85e253f7efd0129bda Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 23 Apr 2018 16:16:46 +0200 Subject: [PATCH] store fetched media in db right after getting folders --- .../gallery/asynctasks/GetDirectoriesAsynctask.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt index 64b8d9756..cb2436672 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -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)