This took a bit to do while doing a general code clean up but
there is a few things going on:
For full screen all you need to do is call:
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN
But you might want to use a listerner to check for visibility changes, aka receiving a notification or user dragging status bar. To not be too invasive what I did was, when that happens and the listener catches the loss of full screen state, the variable isFullScreenActive is set to false.
When user taps screen, the fragments toggle their visibility, so it might be more intuitive that when user taps screen, if there is a status bar or something on screen, it disappears too. So here is where it checks for the isFullScreenActive value and if false it calls the setUpFullScreen function and changes the isFullScreenActive value to true.
The only little other challenge is that when you have the user select media, the listener gets triggered because the system ui is displayed. When this happens the fullscreenactive variable changes to false. And in the OnResume section there is a check to make it go fullscreen again.
This took a bit to do while doing a general code clean up but
For full screen all you need to do is call:
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN
But you might want to use a listerner to check for visibility changes, aka receiving a notification or user dragging status bar. To not be too invasive what I did was, when that happens and the listener catches the loss of full screen state, the variableisFullScreenActive
is set to false.When user taps screen, the fragments toggle their visibility, so it might be more intuitive that when user taps screen, if there is a status bar or something on screen, it disappears too. So here is where it checks for the
isFullScreenActive
value and if false it calls thesetUpFullScreen
function and changes theisFullScreenActive
value to true.The only little other challenge is that when you have the user select media, the listener gets triggered because the system ui is displayed. When this happens the fullscreenactive variable changes to false. And in the
OnResume
section there is a check to make it go fullscreen again.