I have this listener:
val listener = WindowInsetsControllerCompat.OnControllableInsetsChangedListener { controller: WindowInsetsControllerCompat, typeMask: Int ->
Log.i(FragmentVodPlayer.TAG, "onControllableInsetsChanged: changed")
if (typeMask and WindowInsetsCompat.Type.statusBars()
== WindowInsetsCompat.Type.statusBars()
|| typeMask and WindowInsetsCompat.Type.navigationBars()
== WindowInsetsCompat.Type.navigationBars()
) {
hideAfterAWhile.postDelayed({
controller.hide(
WindowInsetsCompat.Type.navigationBars()
or WindowInsetsCompat.Type.statusBars()
)
}, 3000)
}
}
And I'm adding it to instetsController like this:
insetsController.addOnControllableInsetsChangedListener(listener)
It works fine when I'm executing:
insetsController.hide(
WindowInsetsCompat.Type.statusBars()
or WindowInsetsCompat.Type.navigationBars()
)
But when I tap my screen and the navigation bar shows up, this listener never triggers, and from what I read in docs it should.
I know that this listener works when I hide system bars cos I can see it prints messages into my logcat.