public override bool OnTouchEvent(MotionEvent motionEvent)
 {
     return(CoreUtility.ExecuteFunction("OnTouchEvent", delegate()
     {
         mGestureDetector.OnTouchEvent(motionEvent);
         mDragHelper.ProcessTouchEvent(motionEvent);
         return true;
     }));
 }
Exemple #2
0
 /// <summary>
 /// Dispatches touch event to the draggable view.
 /// The touch is realized only if is over the draggable view.
 /// </summary>
 /// <param name="e"></param>
 /// <returns></returns>
 public override bool OnTouchEvent(MotionEvent e)
 {
     try
     {
         DragHelper.ProcessTouchEvent(e);
         return(IsViewTouched(DraggableView, (int)e.GetX(), (int)e.GetY()));
     }
     catch (Exception exception)
     {
         Methods.DisplayReportResultTrack(exception);
         return(base.OnTouchEvent(e));
     }
 }
        public override bool OnTouchEvent(CoordinatorLayout parent, Java.Lang.Object cChild, MotionEvent ev)
        {
            var child = cChild.JavaCast <View>();

            if (!child.IsShown)
            {
                return(false);
            }

            var action = ev.ActionMasked;

            if (_state == StateDragging && action == MotionEventActions.Down)
            {
                return(true);
            }

            // Detect scroll direction for ignoring collapsible
            if (_lastStableState == StateAnchorPoint && action == MotionEventActions.Move)
            {
                if (ev.GetY() > _initialY && !Collapsible)
                {
                    Reset();
                    return(false);
                }
            }

            if (_viewDragHelper == null)
            {
                _viewDragHelper = ViewDragHelper.Create(parent, _dragCallback);
            }

            _viewDragHelper.ProcessTouchEvent(ev);

            if (action == MotionEventActions.Down)
            {
                Reset();
            }

            // The ViewDragHelper tries to capture only the top-most View. We have to explicitly tell it
            // to capture the bottom sheet in case it is not captured and the touch slop is passed.
            if (action == MotionEventActions.Move && !_ignoreEvents && System.Math.Abs(_initialY - ev.GetY()) > _viewDragHelper.TouchSlop)
            {
                _viewDragHelper.CaptureChildView(child, ev.GetPointerId(ev.ActionIndex));
            }


            return(!_ignoreEvents);
        }
Exemple #4
0
        public override bool OnTouchEvent(MotionEvent ev)
        {
            if (!_canSlide || !SlidingEnabled)
            {
                return(base.OnTouchEvent(ev));
            }

            _dragHelper.ProcessTouchEvent(ev);
            var action = (int)ev.Action;

            switch (action & MotionEventCompat.ActionMask)
            {
            case (int)MotionEventActions.Down:
            {
                var x = ev.GetX();
                var y = ev.GetY();
                _initialMotionX = x;
                _initialMotionY = y;
                break;
            }

            case (int)MotionEventActions.Up:
            {
                var x        = ev.GetX();
                var y        = ev.GetY();
                var dx       = x - _initialMotionX;
                var dy       = y - _initialMotionY;
                var slop     = _dragHelper.TouchSlop;
                var dragView = _dragView ?? _slideableView;
                if (dx * dx + dy * dy < slop * slop && IsDragViewUnder((int)x, (int)y))
                {
                    dragView.PlaySoundEffect(SoundEffects.Click);
                    if (!IsExpanded && !IsAnchored)
                    {
                        ExpandPane(_anchorPoint);
                    }
                    else
                    {
                        CollapsePane();
                    }
                }
                break;
            }
            }

            return(true);
        }
Exemple #5
0
 public override bool OnTouchEvent(MotionEvent e)
 {
     mDragHelper.ProcessTouchEvent(e);
     return(true);
 }