Пример #1
0
        /// <summary>
        /// Called when the current event occurred when a gesture IS in progress. The
        /// handling in this implementation may set the gesture out of progress.
        /// </summary>
        /// <param name="actionCode">Action code.</param>
        /// <param name="e">E.</param>
        protected override void HandleInProgressEvent(MotionEventActions actionCode, MotionEvent e)
        {
            switch (actionCode)
            {
            case MotionEventActions.Up:
            case MotionEventActions.Cancel:
                if (_tapPeriod > (e.EventTime - _firstEventTime))
                {
                    _listener.OnTap(this);
                    ResetState();
                }
                break;

            case MotionEventActions.Move:
                if (_tapPeriod < (e.EventTime - _firstEventTime))
                {
                    ResetState();
                }
                break;
            }
        }
Пример #2
0
        /// <summary>
        /// Called when the current event occurred when a gesture IS in progress. The
        /// handling in this implementation may set the gesture out of progress.
        /// </summary>
        /// <param name="actionCode">Action code.</param>
        /// <param name="e">E.</param>
        protected override void HandleInProgressEvent(MotionEventActions actionCode, MotionEvent e)
        {
            switch (actionCode)
            {
            case MotionEventActions.Up:
            case MotionEventActions.Cancel:
                if (_tapPeriod > (e.EventTime - _firstEventTime) &&
                    _xTolerance >= (System.Math.Abs(e.GetX() - _x)) &&
                    _yTolerance >= (System.Math.Abs(e.GetY() - _y)))
                {
                    _listener.OnTap(this);
                    ResetState();
                }
                break;

            case MotionEventActions.Move:
                if (_tapPeriod < (e.EventTime - _firstEventTime))
                {
                    ResetState();
                }
                break;
            }
        }