blonsky95 / TimeStopperAndroid

0 stars 0 forks source link

About full screen #19

Closed blonsky95 closed 3 years ago

blonsky95 commented 3 years ago

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 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.