public override bool OnScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { //if (_debugEvents) System.Diagnostics.Debug.WriteLine ("OnScroll ["+eN.Action+"]["+_id+"] e1=["+e0+"] e2=["+eN+"]"); //System.Diagnostics.Debug.WriteLine("SCROLL"); bool handled = false; StopTapLongPress(); if (!_multiMoving) { var _view = (Android.Views.View)_weakReferenceView?.Get(); if (_view == null || _listeners == null || !_listeners.Any()) { return(false); } _panning = true; foreach (var listener in _listeners) { if (listener.HandlesPanning || listener.HandlesPanned) { PanEventArgs args = new AndroidPanEventArgs(LastPan ?? Start, e2, LastPanArgs, _view, _viewLocationAtOnDown); args.Listener = listener; listener.OnPanning(args); LastPanArgs = args; LastPan = e2; //handled = true; handled |= args.Handled; //if (args.Handled) // break; } } } return(handled); }
public bool OnUp(MotionEvent ev) { //System.Diagnostics.Debug.WriteLine("NativeGestureListener." + P42.Utils.ReflectionExtensions.CallerMemberName() + " action:" + ev.Action + " index" + ev.ActionIndex + " e:" + ev); if (ev.Action != MotionEventActions.Up) { return(false); } var touchDuration = DateTime.Now - _onDownDateTime; _numberOfTaps++; LongPressingTimerStop(); TappedTimerStart(ev, _numberOfTaps); var _view = (Android.Views.View)_weakReferenceView?.Get(); if (_view == null || _listeners == null || !_listeners.Any()) { return(false); } bool handled = false; foreach (var listener in _listeners) { if (listener.HandlesUp) { DownUpEventArgs args = new AndroidDownUpEventArgs(ev, _view, _viewLocationAtOnDown); args.Listener = listener; listener.OnUp(args); handled |= args.Handled; //if (args.Handled) // break; } } if (_panning) { _numberOfTaps = 0; foreach (var listener in _listeners) { if (listener.HandlesPanned) { PanEventArgs args = new AndroidPanEventArgs(LastPan ?? Start, ev, LastPanArgs, _view, _viewLocationAtOnDown); args.Listener = listener; listener.OnPanned(args); handled |= args.Handled; //if (args.Handled) // break; } } } else if (_longPressed) { foreach (var listener in _listeners) { if (listener.HandlesLongPressed) { LongPressEventArgs args = new AndroidLongPressEventArgs(Start, ev, _view, _viewLocationAtOnDown); args.Listener = listener; listener.OnLongPressed(args); handled |= args.Handled; //if (args.Handled) // break; } } } else if (!_pinching && !_rotating) { foreach (var listener in _listeners) { if (listener.HandlesTapping) { TapEventArgs args = new AndroidTapEventArgs(ev, _view, _numberOfTaps, _viewLocationAtOnDown); args.Listener = listener; listener.OnTapping(args); handled |= args.Handled; //if (args.Handled) // break; } } if (_numberOfTaps % 2 == 0) { foreach (var listener in _listeners) { if (listener.HandlesDoubleTapped) { TapEventArgs args = new AndroidTapEventArgs(ev, _view, _numberOfTaps, _viewLocationAtOnDown); args.Listener = listener; listener.OnDoubleTapped(args); handled |= args.Handled; //if (args.Handled) // break; } } } } LastPanArgs = null; LastPan = null; return(handled); }