I have a SurfaceView that uses a canvas to render based on touch events. The activity also uses immersive mode to make it full screen.
The problem is that when the user swipes from the top of the screen to exit immersive mode, the swipe is picked up by the canvas.
How do I avoid these touch events from being processed in the canvas?
SurfaceView class
public class PEQSurfaceView extends SurfaceView implements
SurfaceHolder.Callback
{
@Override
public void surfaceCreated(SurfaceHolder holder)
{
// make the GamePanel focusable so it can handle events
requestFocus();
setFocusable(true);
setFocusableInTouchMode(true);
}
@Override
public boolean onTouchEvent(MotionEvent event)
{...}
The layout also has some standard controls on the side, and I noticed that these are also affected in the same way. I.e. the progress bars will progress if the swipe down touches them