October 2018
Intermediate to advanced
464 pages
15h 17m
English
We call setSystemUiVisibility() with the appropriate flags in the showSystemUI() and hideSystemUI() methods to set the application window state. The flags we set (and don't set) control what is visible and what is hidden. When we set the visibility without the SYSTEM_UI_FLAG_IMMERSIVE flag, we in effect disable Immersive Mode.
If all we wanted to do was hide the System UI, we could just add hideSystemUI() to onCreate() and we'd be done. The problem is it wouldn't stay hidden. Once the user left Immersive Mode, it would stay in the regular display mode. That's why we created the GestureListener. (We'll discuss gestures again in Chapter 9, Using the Touchscreen and Sensors.) Since we only want to respond to the onSingleTapUp() ...