Migrate Accompanist SwipeRefresh to Compose PullRefresh (#8106)

This commit is contained in:
stevenyomi
2022-12-08 11:40:57 +08:00
committed by GitHub
parent 6ca32710be
commit 2c4ddca38e
9 changed files with 66 additions and 59 deletions

View File

@@ -18,7 +18,7 @@ import eu.kanade.core.prefs.PreferenceMutableState
import eu.kanade.domain.category.model.Category
import eu.kanade.domain.library.model.LibraryDisplayMode
import eu.kanade.domain.library.model.LibraryManga
import eu.kanade.presentation.components.SwipeRefresh
import eu.kanade.presentation.components.PullRefresh
import eu.kanade.presentation.components.rememberPagerState
import eu.kanade.tachiyomi.ui.library.LibraryItem
import kotlinx.coroutines.delay
@@ -79,11 +79,11 @@ fun LibraryContent(
}
}
SwipeRefresh(
PullRefresh(
refreshing = isRefreshing,
onRefresh = {
val started = onRefresh(categories[currentPage()])
if (!started) return@SwipeRefresh
if (!started) return@PullRefresh
scope.launch {
// Fake refresh status but hide it after a second as it's a long running task
isRefreshing = true