diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt index 3544d639e..3c03002fe 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt @@ -104,6 +104,7 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay import kotlinx.coroutines.launch import kotlinx.coroutines.withContext +import kotlin.time.Duration.Companion.seconds @Composable fun ZoomableContentView( @@ -180,15 +181,11 @@ fun TwoSecondController( content: BaseMediaContent, inner: @Composable (controllerVisible: MutableState) -> Unit, ) { - val controllerVisible = remember { mutableStateOf(true) } + val controllerVisible = remember(content) { mutableStateOf(true) } LaunchedEffect(content) { - launch(Dispatchers.Default) { - delay(2000) - withContext(Dispatchers.Main) { - controllerVisible.value = false - } - } + delay(2.seconds) + controllerVisible.value = false } inner(controllerVisible)