Change spinner to lazily read database stuff.

Otherwise you get into situations where Spinner will force DB accesses
super early during Application#onCreate on the main thread, which can be
bad when testing large DB migrations.
This commit is contained in:
Greyson Parrelli
2022-12-15 15:17:25 -05:00
committed by Cody Henthorne
parent 3ce5a7da67
commit 10f78d5daa
4 changed files with 39 additions and 35 deletions

View File

@@ -20,10 +20,10 @@ class MainActivity : AppCompatActivity() {
Spinner.init(
application,
mapOf(
"Name" to "${Build.MODEL} (API ${Build.VERSION.SDK_INT})",
"Package" to packageName
"Name" to { "${Build.MODEL} (API ${Build.VERSION.SDK_INT})" },
"Package" to { packageName }
),
mapOf("main" to Spinner.DatabaseConfig(db = db)),
mapOf("main" to Spinner.DatabaseConfig(db = { db })),
emptyMap()
)
}