feat: something

This commit is contained in:
aayush262
2024-06-30 22:29:30 +05:30
parent b09f26ed34
commit 79742f415b
8 changed files with 40 additions and 29 deletions

View File

@@ -38,6 +38,7 @@ import ani.dantotsu.snackString
import ani.dantotsu.statusBarHeight
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@@ -289,15 +290,20 @@ class AnimeFragment : Fragment() {
}
}
}
model.loaded = true
model.loadTrending(1)
model.loadAll()
}
model.loaded = true
val loadTrending = async(Dispatchers.IO) { model.loadTrending(1) }
val loadAll = async(Dispatchers.IO) { model.loadAll() }
val loadPopular = async(Dispatchers.IO) {
model.loadPopular(
"ANIME", sort = Anilist.sortBy[1], onList = PrefManager.getVal(
PrefName.PopularAnimeList
)
"ANIME",
sort = Anilist.sortBy[1],
onList = PrefManager.getVal(PrefName.PopularAnimeList)
)
}
loadTrending.await()
loadAll.await()
loadPopular.await()
live.postValue(false)
_binding?.animeRefresh?.isRefreshing = false
running = false

View File

@@ -35,6 +35,7 @@ import ani.dantotsu.snackString
import ani.dantotsu.statusBarHeight
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@@ -274,15 +275,22 @@ class MangaFragment : Fragment() {
}
}
}
model.loaded = true
model.loadTrending()
model.loadAll()
}
model.loaded = true
val loadTrending = async(Dispatchers.IO) { model.loadTrending() }
val loadAll = async(Dispatchers.IO) { model.loadAll() }
val loadPopular = async(Dispatchers.IO) {
model.loadPopular(
"MANGA", sort = Anilist.sortBy[1], onList = PrefManager.getVal(
PrefName.PopularMangaList
)
"MANGA",
sort = Anilist.sortBy[1],
onList = PrefManager.getVal(PrefName.PopularAnimeList)
)
}
loadTrending.await()
loadAll.await()
loadPopular.await()
live.postValue(false)
_binding?.mangaRefresh?.isRefreshing = false
running = false