diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/databases/GalleryDatabase.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/databases/GalleryDatabase.kt index 0c94fb848..104a250cf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/databases/GalleryDatabase.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/databases/GalleryDatabase.kt @@ -1,9 +1,10 @@ package com.simplemobiletools.gallery.databases +import android.content.Context import androidx.room.Database import androidx.room.Room import androidx.room.RoomDatabase -import android.content.Context +import com.simplemobiletools.gallery.objects.MyExecutor import com.simplemobiletools.gallery.interfaces.DirectoryDao import com.simplemobiletools.gallery.interfaces.MediumDao import com.simplemobiletools.gallery.models.Directory @@ -25,6 +26,7 @@ abstract class GalleryDatabase : RoomDatabase() { if (db == null) { db = Room.databaseBuilder(context.applicationContext, GalleryDatabase::class.java, "gallery.db") .fallbackToDestructiveMigration() + .setQueryExecutor(MyExecutor.myExecutor) .build() db!!.openHelper.setWriteAheadLoggingEnabled(true) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/objects/MyExecutor.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/objects/MyExecutor.kt new file mode 100644 index 000000000..c4ff990a9 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/objects/MyExecutor.kt @@ -0,0 +1,7 @@ +package com.simplemobiletools.gallery.objects + +import java.util.concurrent.Executors + +object MyExecutor { + val myExecutor = Executors.newSingleThreadExecutor() +}