/// <summary>
        /// Animates the hidden menu for the given row, if it has one.
        /// </summary>
        /// <param name="position">Position.</param>
        public void SmoothOpenMenu(int position)
        {
            var lm = GetLayoutManager();
            var v  = lm.FindViewByPosition(position) as SwipeMenuLayout;

            if (v != null)
            {
                touchPosition = position;

                if (touchView != null && touchView.isOpen)
                {
                    touchView.Close();
                }

                touchView = v;
                touchView.Open();
            }
        }
        public override bool OnInterceptTouchEvent(MotionEvent ev)
        {
            if (ev.Action != MotionEventActions.Down && touchView == null)
            {
                return(base.OnInterceptTouchEvent(ev));
            }
            else if (!swipingEnabled)
            {
                return(base.OnInterceptTouchEvent(ev));
            }

            switch (ev.Action)
            {
            case MotionEventActions.Down:
                dx             = dy = 0.0f;
                startClickTime = DateTime.Now;
                int oldPos = touchPosition;
                downX = ev.GetX();
                downY = ev.GetY();

                touchState    = ETouchState.None;
                touchPosition = GetChildAdapterPosition(FindChildViewUnder(downX, downY));

                if (touchPosition == oldPos && touchView != null && touchView.isOpen)
                {
                    if (!touchView.OnTouchEvent(ev))
                    {
                        touchState = ETouchState.X;
                        touchView.OnSwipe(ev);
                    }
                }

                // Find the touched child view
                View view = null;
                var  vh   = FindViewHolderForAdapterPosition(touchPosition);
                if (vh != null)
                {
                    view = vh.ItemView;
                }

                if (touchPosition != oldPos && touchView != null && touchView.isOpen)
                {
                    touchView.Close();
                    touchView = null;
                    var cancelEvent = MotionEvent.Obtain(ev);
                    cancelEvent.Action = MotionEventActions.Cancel;
                    base.OnTouchEvent(cancelEvent);
                    L.D(this, "Returning true");
                    return(true);
                }

                touchView = view as SwipeMenuLayout;
                if (touchView != null)
                {
                    touchView.recyclerView = this;
                    touchView.OnSwipe(ev);
                }
                break;                 // MotionEventActions.Down

            case MotionEventActions.Move:
                dx = Math.Abs(ev.GetX() - downX);
                dy = Math.Abs(ev.GetY() - downY);

                if (touchState == ETouchState.X && touchView.isSwipeEnabled)
                {
                    touchView.OnSwipe(ev);
                    ev.Action = MotionEventActions.Cancel;
                    base.OnTouchEvent(ev);
                }
                else if (touchState == ETouchState.None && touchView.isSwipeEnabled)
                {
                    if (Math.Abs(dy) > viewConfig.ScaledTouchSlop)
                    {
                        touchState = ETouchState.Y;
                    }
                    else if (dx > viewConfig.ScaledTouchSlop)
                    {
                        touchState = ETouchState.X;
                        NotifySwipeStart(touchPosition);
                    }
                }
                break;                 // MotionEventActions.Move

            case MotionEventActions.Up:
                bool isCloseOnUpEvent = false;

                if (touchState == ETouchState.X && touchView.isSwipeEnabled)
                {
                    isCloseOnUpEvent = !touchView.OnSwipe(ev);
                    NotifySwipeEnd(touchPosition);

                    if (!touchView.isOpen)
                    {
                        touchPosition = -1;
                        touchView     = null;
                    }

                    ev.Action = MotionEventActions.Cancel;
                    base.OnTouchEvent(ev);
                }

                var clickDuration = DateTime.Now - startClickTime;
                var isOutOfTime   = clickDuration > TimeSpan.FromMilliseconds(ViewConfiguration.LongPressTimeout);
                var isOutX        = dx > viewConfig.ScaledTouchSlop;
                var isOutY        = dy > viewConfig.ScaledTouchSlop;
                if (isOutOfTime || isOutX || isOutY)
                {
                    return(true);
                }
                else
                {
                    var evX = ev.GetX();
                    var evY = ev.GetY();

                    var upView = FindChildViewUnder(evX, evY) as SwipeMenuLayout;
                    if (upView != null)
                    {
                        var x  = evX - upView.Left;
                        var y  = evY - upView.Top;
                        var mv = upView.background;
                        var tx = mv.TranslationY;
                        var ty = mv.TranslationX;
                        if (!(x >= mv.Left + tx && x <= mv.Right + tx && y >= mv.Top + ty && y <= mv.Bottom + ty) && isCloseOnUpEvent)
                        {
                            return(true);
                        }
                    }
                }

                break;                 // MotionEventActions.Up;

            case MotionEventActions.Cancel:
                if (touchView != null && touchView.isSwipeEnabled)
                {
                    ev.Action = MotionEventActions.Up;
                    touchView.OnSwipe(ev);
                }
                break;                 // MotionEventActions.Cancel
            }

            return(base.OnInterceptTouchEvent(ev));
        }