Deny mainthread db query!
This commit is contained in:
1 parent
77bb6e9a82
commit
7d87417095
2 files changed
+10
-7
No files matched your search
@@ -22,7 +22,5 @@ abstract class EhDatabase : RoomDatabase() {
|
||||
}
|
||||
|
||||
fun buildMainDB(context: Context): EhDatabase {
|
||||
// TODO: Remove allowMainThreadQueries
|
||||
return Room.databaseBuilder(context, EhDatabase::class.java, "eh.db").allowMainThreadQueries()
|
||||
.build()
|
||||
return Room.databaseBuilder(context, EhDatabase::class.java, "eh.db").build()
|
||||
}
|
||||
@@ -305,10 +305,15 @@ class ReaderActivity : EhActivity() {
|
||||
return
|
||||
}
|
||||
|
||||
mGalleryProvider!!.start()
|
||||
|
||||
lifecycleScope.launchUI {
|
||||
if (mGalleryProvider!!.awaitReady()) setGallery()
|
||||
mGalleryProvider.let {
|
||||
if (it == null) {
|
||||
finish()
|
||||
return
|
||||
}
|
||||
lifecycleScope.launchIO {
|
||||
it.start()
|
||||
if (it.awaitReady()) withUIContext { setGallery() }
|
||||
}
|
||||
}
|
||||
|
||||
config = ReaderConfig()
|
||||
|
||||
Reference in new issue
Block a user