DoodleView Methods hideSystemBars and showSystemBars

This app uses Android 4.4’s new immersive mode to allow users to draw on the entire screen. When the user taps the screen, a GestureDetector’s SimplyOnGestureListener (Fig. 7.27) determines whether the system bars and action bar are displayed. If so, method hideSystemBars (Fig. 7.26, lines 120–130) is called; otherwise, method showSystemBars (Fig. 7.26, lines 133–140) is called. For this app, we enable immersive mode only for Android 4.4. So, both methods first check whether the version of Android running on the device—Build.VERSION_SDK_INT—is greater than or equal to the constant for Android 4.4 (API level 19)—Build.VERSION_CODES_KITKAT. If so, both methods use View method setSystemUiVisibility ...

Get Android™ How to Program, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.