Use kotlin.time extensions in some more places

This commit is contained in:
arkon
2022-10-22 19:57:55 -04:00
parent 39e41510d0
commit 5c868d7846
8 changed files with 20 additions and 12 deletions

View File

@@ -15,6 +15,7 @@ import eu.kanade.presentation.components.ScrollbarLazyColumn
import eu.kanade.presentation.more.settings.screen.SearchableSettings
import eu.kanade.presentation.more.settings.widget.PreferenceGroupHeader
import kotlinx.coroutines.delay
import kotlin.time.Duration.Companion.seconds
/**
* Preference Screen composable which contains a list of [Preference] items
@@ -33,7 +34,7 @@ fun PreferenceScreen(
LaunchedEffect(Unit) {
val i = items.findHighlightedIndex(highlightKey)
if (i >= 0) {
delay(500)
delay(0.5.seconds)
state.animateScrollToItem(i)
}
SearchableSettings.highlightKey = null

View File

@@ -32,6 +32,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import eu.kanade.presentation.more.settings.LocalPreferenceHighlighted
import kotlinx.coroutines.delay
import kotlin.time.Duration.Companion.seconds
@Composable
internal fun BasePreferenceWidget(
@@ -89,7 +90,7 @@ internal fun Modifier.highlightBackground(highlighted: Boolean): Modifier = comp
LaunchedEffect(Unit) {
if (highlighted) {
highlightFlag = true
delay(3000)
delay(3.seconds)
highlightFlag = false
}
}