Example #1
0
        public override bool OnTouchEvent(MotionEvent motionEvent)
        {
            switch (motionEvent.Action)
            {
            case MotionEventActions.Down:
                var touchDown = motionEvent.ToPointF();
                if (pointIsInActionableArea(touchDown))
                {
                    lastTouch = touchDown;
                }
                return(base.OnTouchEvent(motionEvent));

            case MotionEventActions.Up:
                var touchUp = motionEvent.ToPointF();
                if (pointIsInActionableArea(touchUp) &&
                    touchUpIsCloseEnoughToLastTouch(touchUp) &&
                    !lastTouchInterceptsAnyChild(touchUp))
                {
                    emptySpaceTouchedSubject.OnNext(touchUp);
                }

                lastTouch = null;
                return(base.OnTouchEvent(motionEvent));

            case MotionEventActions.Cancel:
            case MotionEventActions.Outside:
                lastTouch = null;
                return(base.OnTouchEvent(motionEvent));

            default:
                return(base.OnTouchEvent(motionEvent));
            }
        }