Example #1
0
        bool global::Android.Views.View.IOnTouchListener.OnTouch(global::Android.Views.View v, MotionEvent e)
        {
            if (!_isEnabled)
            {
                return(true);
            }

            if (_inputTransparent)
            {
                return(false);
            }

            var handled = false;

            if (_pinchGestureHandler.IsPinchSupported)
            {
                if (!_scaleDetector.IsValueCreated)
                {
                    ScaleGestureDetectorCompat.SetQuickScaleEnabled(_scaleDetector.Value, true);
                }
                handled = _scaleDetector.Value.OnTouchEvent(e);
            }

            if (_gestureDetector.IsValueCreated && _gestureDetector.Value.Handle == IntPtr.Zero)
            {
                // This gesture detector has already been disposed, probably because it's on a cell which is going away
                return(handled);
            }

            // It's very important that the gesture detection happen first here
            // if we check handled first, we might short-circuit and never check for tap/pan
            handled = _gestureDetector.Value.OnTouchEvent(e) || handled;

            v.EnsureLongClickCancellation(e, handled, Element);

            return(handled);
        }