PhotoViewerTest.Droid.PhotoViewDroidAttacher.OnTouch C# (CSharp) Метод

OnTouch() публичный Метод

public OnTouch ( Android.Views.View v, Android.Views.MotionEvent ev ) : bool
v Android.Views.View
ev Android.Views.MotionEvent
Результат bool
        public bool OnTouch(View v, MotionEvent ev)
        {
            bool handled = false;

            if (mZoomEnabled && HasDrawable((ImageView) v)) {
                IViewParent parent = v.Parent;
                switch (ev.Action) {
                case MotionEventActions.Down:
                    // First, disable the Parent from intercepting the touch
                    // event
                    if (null != parent)
                        parent.RequestDisallowInterceptTouchEvent(true);
                    else
                        Log.Info(LOG_TAG, "onTouch getParent() returned null");

                    // If we're flinging, and the user presses down, cancel
                    // fling
                    CancelFling();
                    break;

                case MotionEventActions.Cancel:
                case MotionEventActions.Up:
                    // If the user has zoomed less than min scale, zoom back
                    // to min scale
                    if (GetScale() < mMinScale) {
                        RectF rect = GetDisplayRect();
                        if (null != rect) {
                            v.Post(new AnimatedZoomRunnable(this,GetScale(), mMinScale,
                                rect.CenterX(), rect.CenterY()));
                            handled = true;
                        }
                    }
                    break;
                }

                // Try the Scale/Drag detector
                if (null != mScaleDragDetector
                    && mScaleDragDetector.OnTouchEvent(ev)) {
                    handled = true;
                }

                // Check to see if the user double tapped
                if (null != mGestureDetector && mGestureDetector.OnTouchEvent(ev)) {
                    handled = true;
                }
            }

            return handled;
        }