mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
Run load tasks concurrently.
This commit is contained in:
parent
6b69353e67
commit
4615c662b4
@ -27,6 +27,8 @@ import com.github.libretube.ui.adapters.PlaylistsAdapter
|
|||||||
import com.github.libretube.ui.adapters.VideosAdapter
|
import com.github.libretube.ui.adapters.VideosAdapter
|
||||||
import com.github.libretube.ui.models.SubscriptionsViewModel
|
import com.github.libretube.ui.models.SubscriptionsViewModel
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.async
|
||||||
|
import kotlinx.coroutines.awaitAll
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
@ -80,10 +82,12 @@ class HomeFragment : Fragment() {
|
|||||||
private fun fetchHomeFeed() {
|
private fun fetchHomeFeed() {
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
loadTrending()
|
awaitAll(
|
||||||
loadBookmarks()
|
async { loadTrending() },
|
||||||
loadFeed()
|
async { loadBookmarks() },
|
||||||
loadPlaylists()
|
async { loadFeed() },
|
||||||
|
async { loadPlaylists() }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user