How to observe systemBars appearance in compose

53 Views Asked by At

I'm trying to listen for the appearance of the systemBars, so i can hide them after a finite amount of time (to go back to the immersive view), I'm able to hide & show the system bars but i can't seem to observe the appearance effectively.

My initial approach is doesn't seem to be effective, pls is there a better way to achieve this using compose.

// readerScreenBars is a mutableStateOf(true/false) var that i toggle to hide the bars & SystemBars

while (!readerScreenBars) { //Using while to observe when the appBars !visible

    if (!readerScreenBars && systemUiController.isSystemBarsVisible){ //if the systemBars visible and the appbar !visible

        LaunchedEffect(Unit) {
            delay(4.seconds)
            systemUiController.isSystemBarsVisible = false

        break
    }

}

image

0

There are 0 best solutions below