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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.