Nicolas Acart
06/14/2021, 12:23 AMViewCompat.setOnApplyWindowInsetsListener(window.decorView) { _, insets ->
val isKeyboardVisible = insets.isVisible(WindowInsetsCompat.Type.ime())
onSoftKeyboardVisibilityChange(isKeyboardVisible)// own method which notifies me of changes
insets
}
This way worked in the emulator (Pixel 3a API 30) but not on my phone (Galaxy S8 API 28)
On top of that after launching my app, I noticed that my statusBarColor and navigationBarColor from themes.xml no longer work (status and nav bars are white or dark according to the theme instead of my own colors set in themes.xml)
I tried to change window.navigationBarColor
and window.statusBarColor
in the setContent without success
I don't understand what's going on. Is it possible to have an explanation ?Ian Lake
06/14/2021, 1:29 AMinsets
module of Accompanist? It has support for keyboard insets https://google.github.io/accompanist/insets/Nicolas Acart
06/14/2021, 1:06 PMChuck Stein
08/12/2021, 8:01 PMLocalWindowInsets.current.ime.isVisible
, but I don't see a way to add a listener for when this visibility changes, without resorting to calling ViewCompat.setOnApplyWindowInsetsListener(window.decorView)
in the Activity. Is this what you ended up doing? I'd like to not have to use the Activity at all and keep this isolated to the Compose tree if possible.Nicolas Acart
08/26/2021, 1:33 AMWindowCompat.setDecorFitsSystemWindows(window, false)
at the start of the onCreate method of my activity. And then :
LocalWindowInsets.current.ime.isVisible
wherever I need it.
By the way, I found that using LocalWindows.current.ime.animationInProgress
could be very useful sometimes when you need to know that the keyboard is opening or closing instead of opened or closed.Nicolas Acart
08/26/2021, 1:37 AMLaunchedEffect(LocalWindows.current.ime.isVisible) {
//TODO()
}
Chuck Stein
08/26/2021, 6:20 PMsnapshotFlow
inside of a LaunchedEffect
to react to visibility changes. I wonder if just using LaunchedEffect
directly like that works the same way?