fix: combine anilist init queries into one query

This commit is contained in:
rebelonion 2024-02-08 05:06:09 -06:00
parent 3d4834507d
commit b829ed26f3
5 changed files with 268 additions and 16 deletions

View file

@ -305,7 +305,7 @@ class HomeFragment : Fragment() {
}
}
val array = arrayOf(
val array = arrayOf( //deprecated: no longer should be run. only indices are used
Runnable { runBlocking { model.setAnimeContinue() } },
Runnable { runBlocking { model.setAnimeFav() } },
Runnable { runBlocking { model.setAnimePlanned() } },
@ -339,9 +339,11 @@ class HomeFragment : Fragment() {
var empty = true
val homeLayoutShow: List<Boolean> =
PrefManager.getVal(PrefName.HomeLayoutShow)
runBlocking {
model.initHomePage()
}
(array.indices).forEach { i ->
if (homeLayoutShow.elementAt(i)) {
array[i].run()
empty = false
} else withContext(Dispatchers.Main) {
containers[i].visibility = View.GONE