Anonymous Inner Class that Implements Interface SimpleOnGestureListener

Figure 7.27 creates the SimpleOnGestureListener named singleTapListener, which was registered at lines 60–61(Fig. 7.22) with the GestureDetector. Recall that SimpleOnGestureListener is an adapter class that implements interfaces OnGestureListener and OnDoubleTapListener. The methods simply return false—indicating that the events were not handled. We override only the onSingleTap method (lines 146–155), which is called when the user taps the screen. We determine whether the system bars and app bar are displayed (lines 149–150) by calling method View method getSystemUiVisibilty and combining its result with the constant View.SYSTEM_UI_FLAG_HIDE_NAVIGATION. If the result is ...

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.