Open eero-lehtinen opened 10 months ago
This is super helpful!
For my case, env.call_method(&insets_controller, "hide", "(I)V", &[JValue::from(3)])?;
did the trick.
The value is supposed to be retrieved by calling WindowInsetsCompat.Type.systemBars()
, I guess it could actually be different values on different devices.
What problem does this solve or what need does it fill?
I think most games would prefer to have the game be full screen instead of showing the title bar and navigation buttons. It is already possible to hide the title bar through Android build configuration in
cargo-apk
orxbuild
, but hiding the navigation buttons requires calling Java functions.What solution would you like?
A boolean paremeter on
WindowPlugin
would be nice to enable or disable this feature. I think it should be on by default for games.What alternative(s) have you considered?
You can always implement it yourself, but it's not trivial.
Additional context
I have crated this monstrosity to achieve this while being very inexperienced in Android APIs. I'm not sure if this works for all Android versions but seems to work for me. There is also
WindowInsetsControllerCompat
, which could have better compatibility, but I couldn't get it to work without crashing. There is an official guide on how to do this differently, but this simple way seems to be enough.