mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-12 12:08:56 +01:00
Some tweaks on Updates screen (#7729)
Based on #7708, #7709 and #7717 Co-Authored-By: Ivan Iskandar <12537387+ivaniskandar@users.noreply.github.com> Co-Authored-By: Andreas <6576096+ghostbear@users.noreply.github.com> Co-authored-by: Ivan Iskandar <12537387+ivaniskandar@users.noreply.github.com> Co-authored-by: Andreas <6576096+ghostbear@users.noreply.github.com>
This commit is contained in:
@@ -24,6 +24,11 @@ import androidx.compose.material3.TopAppBarScrollBehavior
|
||||
import androidx.compose.material3.rememberTopAppBarState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
@@ -49,7 +54,9 @@ import eu.kanade.tachiyomi.ui.recent.updates.UpdatesPresenter
|
||||
import eu.kanade.tachiyomi.ui.recent.updates.UpdatesPresenter.Dialog
|
||||
import eu.kanade.tachiyomi.ui.recent.updates.UpdatesPresenter.Event
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
import java.util.Date
|
||||
|
||||
@Composable
|
||||
@@ -115,9 +122,20 @@ fun UpdateScreen(
|
||||
val contentPaddingWithNavBar = (if (presenter.selectionMode) PaddingValues() else bottomNavPaddingValues) +
|
||||
contentPadding + WindowInsets.navigationBars.only(WindowInsetsSides.Bottom).asPaddingValues()
|
||||
|
||||
val scope = rememberCoroutineScope()
|
||||
var isRefreshing by remember { mutableStateOf(false) }
|
||||
|
||||
SwipeRefresh(
|
||||
state = rememberSwipeRefreshState(isRefreshing = false),
|
||||
onRefresh = onUpdateLibrary,
|
||||
state = rememberSwipeRefreshState(isRefreshing = isRefreshing),
|
||||
onRefresh = {
|
||||
onUpdateLibrary()
|
||||
scope.launch {
|
||||
// Fake refresh status but hide it after a second as it's a long running task
|
||||
isRefreshing = true
|
||||
delay(1000)
|
||||
isRefreshing = false
|
||||
}
|
||||
},
|
||||
swipeEnabled = presenter.selectionMode.not(),
|
||||
indicatorPadding = contentPaddingWithNavBar,
|
||||
indicator = { s, trigger ->
|
||||
|
||||
Reference in New Issue
Block a user