private void UpdateEventHandlers() { _listener.myLabel = label; GenericMotion += (s, a) => _detector.OnTouchEvent(a.Event); Touch += (s, a) => _detector.OnTouchEvent(a.Event); }
public bool OnTouch(View v, MotionEvent e) { if (_gestureDetector.OnTouchEvent(e)) { return(true); } var returnValue = _gestureDetector.OnTouchEvent(e); var x = (int)e.RawX; switch (e.Action) { case MotionEventActions.Move: if (_start) { _prevScrollX = x; _start = false; } break; case MotionEventActions.Up: _start = true; _currentScrollX = x; int minFactor = _itemWidth / SwipePageOnFactor; if ((_prevScrollX - _currentScrollX) > minFactor) { if (_activeItem < _maxItem - 1) { _activeItem = _activeItem + 1; } } else if ((_currentScrollX - _prevScrollX) > minFactor) { if (_activeItem > 0) { _activeItem = _activeItem - 1; } } //_scrollTo = _activeItem * _itemWidth; //SmoothScrollTo(_scrollTo, 0); if (_activeItem != _prevActiveItem) { SetCenter(_activeItem); ItemSelectedChangeEventHandlerArgs args = new ItemSelectedChangeEventHandlerArgs { itemSelected = _activeItem }; OnItemSelectedChangeEventHandler(args); } returnValue = true; break; } return(returnValue); }
public override bool OnTouchEvent(MotionEvent e) { try { _gestureDetector.OnTouchEvent(e); } catch (ObjectDisposedException) { CreateGestureDetector(); _gestureDetector.OnTouchEvent(e); } if (e.ActionMasked == MotionEventActions.Move) { var density = Context.Resources.DisplayMetrics.Density; var xDelta = GetTotalX(e); var yDelta = GetTotalY(e); SetIsTouchHandled(xDelta, yDelta); UpdatePan(GestureStatus.Running, xDelta, yDelta); } HandleDownUpEvents(e); return(true); }
void HandleTouch(object sender, TouchEventArgs e) { RoundedBoxView view = this.Element as RoundedBoxView; if (view != null) { if (view.IsInteractable == false) { e.Handled = false; } else { if (e.Event.Action == MotionEventActions.Up) { _tapEnded = true; Rect rc = new Rect(); GetDrawingRect(rc); int x = (int)e.Event.GetX(), y = (int)e.Event.GetY(); view.RaiseTapEnded((DateTime.Now - this._timeCalc).TotalMilliseconds, rc.Contains(x, y) == false); view.RaiseTapUp((DateTime.Now - this._timeCalc).TotalMilliseconds, rc.Contains(x, y) == false); } _detector.OnTouchEvent(e.Event); } } }
void HandleTouch(object sender, TouchEventArgs e) { _scaleDetector.OnTouchEvent(e.Event); if (!_scaleDetector.IsInProgress) { _gestureDetector.OnTouchEvent(e.Event); } }
protected override void OnElementChanged(ElementChangedEventArgs <Image> e) { base.OnElementChanged(e); _listener.ExImage = Element as ExImage; GenericMotion += (s, a) => _detector.OnTouchEvent(a.Event); Touch += (s, a) => _detector.OnTouchEvent(a.Event); }
public override bool DispatchTouchEvent(MotionEvent e) { bool result = base.DispatchTouchEvent(e); if (_detector != null) { _detector.OnTouchEvent(e); } return(result); }
public override bool DispatchTouchEvent(MotionEvent e) { if (_detector != null) { _detector.OnTouchEvent(e); base.DispatchTouchEvent(e); return(true); } return(base.DispatchTouchEvent(e)); }
void HandleTouch(object sender, TouchEventArgs e) { _detector.OnTouchEvent(e.Event); if (e.Event.Action == MotionEventActions.Up) { RoundedBoxView view = this.Element as RoundedBoxView; if (view != null) { view.RaiseTapEnded(); } } }
public override bool OnTouchEvent(MotionEvent e) { if (_detector.OnTouchEvent(e)) { return(true); } if (e.Action == MotionEventActions.Up) { return(_listener.OnUp(e)); } return(false); }
public bool OnTouch(View v, MotionEvent ev) { if (AnimatingZoomEnding || ev.PointerCount > 2) { return(true); } ScaleGestureDetector.OnTouchEvent(ev); GestureDetector.OnTouchEvent(ev); var action = ev.Action & MotionEventActions.Mask; switch (action) { case MotionEventActions.PointerDown: case MotionEventActions.Down: switch (State) { case STATE_IDLE: State = STATE_POINTER_DOWN; break; case STATE_POINTER_DOWN: State = STATE_ZOOMING; ev.MidPointOfEvent(InitialPinchMidPoint); StartZoomingView(Target); break; } break; case MotionEventActions.Move: if (State == STATE_ZOOMING) { ev.MidPointOfEvent(CurrentMovementMidPoint); CurrentMovementMidPoint.X -= InitialPinchMidPoint.X; CurrentMovementMidPoint.Y -= InitialPinchMidPoint.Y; CurrentMovementMidPoint.X += TargetViewCords.X; CurrentMovementMidPoint.Y += TargetViewCords.Y; float x = CurrentMovementMidPoint.X; float y = CurrentMovementMidPoint.Y; ZoomableView.SetX(x); ZoomableView.SetY(y); } break; case MotionEventActions.PointerUp: case MotionEventActions.Up: case MotionEventActions.Cancel: switch (State) { case STATE_ZOOMING: EndZoomingView(); break; case STATE_POINTER_DOWN: State = STATE_IDLE; break; } break; } return(true); }
public override bool OnTouchEvent(MotionEvent e) { _pdfScaleDetector.OnTouchEvent(e); _pdfGestureDetector.OnTouchEvent(e); return(base.OnTouchEvent(e)); }
public override bool OnTouchEvent(MotionEvent e) { gestureDetector.OnTouchEvent(e); scaleGestureDetector.OnTouchEvent(e); rotationGestureDetector.OnTouch(e); return(true); }
public bool OnTouch(View v, MotionEvent e) { if (!gestureDetector.OnTouchEvent(e)) { // If the event is not handled in one of your gestures, // fall through to the MotionEventActions switch. switch (e.Action) { case MotionEventActions.Down: oldTime = DateTime.Now; break; case MotionEventActions.Move: if (DateTime.Now.Subtract(oldTime) > Milli10) { Console.WriteLine($"Touch {e.RawX} : {e.RawY} : tD: {DateTime.Now.Subtract(oldTime)}"); oldTime = DateTime.Now; } break; default: break; } } return(true); }
public bool OnSwipe(MotionEvent e) { gestureDetector.OnTouchEvent(e); switch (e.Action) { case MotionEventActions.Down: downX = e.GetX(); isFling = false; break; // MotionEventActions.Down case MotionEventActions.Move: int dis = (int)(downX - e.GetX()); if (isOpen) { dis += background.Width * (int)recyclerView.swipeDirection; } Swipe(dis); break; // MotionEventActions.Move case MotionEventActions.Up: if ((isFling || Math.Abs(downX - e.GetX()) > (background.Width / 3)) && Math.Sign(downX - e.GetX()) == (int)recyclerView.swipeDirection) { Open(); } else { Close(); return(false); } break; // MotionEventActions.Up } return(true); }
public override bool DispatchTouchEvent(MotionEvent e) { if (isEnable) { MotionEventActions Action = e.ActionMasked; if (e.PointerCount >= 2) { hasMultiTouch = true; } mDetector.OnTouchEvent(e); if (isRotateEnable) { mRotateDetector.onTouchEvent(e); } mScaleDetector.OnTouchEvent(e); if (Action == MotionEventActions.Up || Action == MotionEventActions.Cancel) { onUp(); } return(true); } else { return(base.DispatchTouchEvent(e)); } }
void HandleGenericMotion(object sender, TouchEventArgs e) { _detector.OnTouchEvent(e.Event); switch (e.Event.Action) { //If action is Down, then we set the x1 value and break case MotionEventActions.Down: x1 = e.Event.GetX(); break; //If action is Up, then we set the x2 and caluclate whether it was a swipe left or right AND swipe was greater then MinimumSwipeDistance case MotionEventActions.Up: x2 = e.Event.GetX(); float delta = x2 - x1; if (Math.Abs(delta) > _sliderView.MinimumSwipeDistance) { if (delta > 0) { _sliderView.OnLeftButtonClicked(); Console.WriteLine("Swipe to the left"); } else if (delta < 0) { _sliderView.OnRightButtonClicked(); } } break; } }
public DragPinchManager(PdfView pdfView, AnimationManager animationManager) { this.pdfView = pdfView; this.animationManager = animationManager; gestureDetector = new GestureDetector(pdfView.Context, this); scaleGestureDetector = new ScaleGestureDetector(pdfView.Context, this); pdfView.Touch += (s, e) => { if (!enabled) { e.Handled = false; } var retVal = scaleGestureDetector.OnTouchEvent(e.Event); retVal = gestureDetector.OnTouchEvent(e.Event) || retVal; if (e.Event.Action != MotionEventActions.Up) { e.Handled = retVal; } if (!scrolling) { e.Handled = retVal; } scrolling = false; OnScrollEnd(e.Event); e.Handled = retVal; }; }
public override bool OnTouchEvent(MotionEvent e) { bool handled; handled = scaleGestureDetector.OnTouchEvent(e); // if (handled) // return true; handled = gestureDetector.OnTouchEvent(e); // if (handled) // return true; if (ccContext.CountLayerContext.IsSelectionValid) { if (e.Action == MotionEventActions.Move) { Vector2 pos = new Vector2(e.GetX(), e.GetY()); Vector2 trans = pos - lastDragPos; ccContext.CountLayerContext.OnDrag(pos, trans); lastDragPos = pos; } else { ccContext.CountLayerContext.OnUnselect(); } } return(true); }
public override bool OnTouchEvent(MotionEvent e) { if (e.ActionMasked == MotionEventActions.Up || e.ActionMasked == MotionEventActions.Cancel) { var(x, y) = ToDip(e.RawX, e.RawY); if (m_isScrolling) { m_elem?.SendPan(x - m_startX, 0, GestureStatus.Completed, m_pointerId); } else { m_elem.SendTapped(x, y); } m_isScrolling = false; return(false); } if (!m_isScrolling && e.ActionMasked == MotionEventActions.Move) // Is needed when this does not contain any children that can handle touch events. { StartScroll(e); } return(m_detector.OnTouchEvent(e)); }
public bool OnInterceptTouchEvent(RecyclerView view, MotionEvent e) { var childView = view.FindChildViewUnder(e.GetX(), e.GetY()); if (childView != null && gestureDetector.OnTouchEvent(e)) { var intent = new Intent(mainActivity, typeof(ExhibitDetailsActivity)); Exhibit exhibit = null; for (var i = 0; i < exhibitSet.ActiveSet.Count; ++i) { exhibit = exhibitSet.ActiveSet [i]; if (exhibit.Id == childView.ContentDescription) { break; } } if (exhibit != null) { var pageList = exhibit.Pages; if (pageList == null || !pageList.Any()) { Toast.MakeText(mainActivity, mainActivity.GetString(Resource.String.currently_no_further_info), ToastLength.Short) .Show(); return(false); } intent.PutExtra(ExhibitDetailsActivity.INTENT_EXTRA_EXHIBIT_ID, exhibit.Id); ActivityCompat.StartActivity(mainActivity, intent, null); } } return(false); }
public virtual bool OnInterceptTouchEvent(RecyclerView view, MotionEvent e) { if (mGestureDetector.Handle != IntPtr.Zero) { return(mGestureDetector.OnTouchEvent(e)); } return(false); }
public override bool OnTouchEvent(MotionEvent e) { if (gestureDetector.OnTouchEvent(e)) { return(true); } return(base.OnTouchEvent(e)); }
//public override bool DispatchTouchEvent(MotionEvent e) //{ // if (!Touchable) // return false; // return base.DispatchTouchEvent(e); //} public override bool OnTouchEvent(MotionEvent e) { if (!Touchable) { return(false); } return(_GestureDetector.OnTouchEvent(e)); }
public override bool OnInterceptTouchEvent(MotionEvent ev) { if (Element is SwipeAwareContainer element && !element.SwipeDetectionDisabled) { _gestureDetector.OnTouchEvent(ev); } return(base.OnInterceptTouchEvent(ev)); }
void HandleTouch(object sender, TouchEventArgs e) { var label = sender as LabelRenderer; if (_detector.OnTouchEvent(e.Event)) { var startX = _listener.StartX; var lastX = _listener.LastX; if (lastX - startX < 200) { ((label.Element as LabelSwipe).GetChart.Series[0] as Calendar).NextMonth(); } else { ((label.Element as LabelSwipe).GetChart.Series[0] as Calendar).PreviousMonth(); } if ((label.Element as LabelSwipe).GetChart.Header.Text == "BasicCalendar") { label.Element.Text = MyConvert.NumericMonthToString(((label.Element as LabelSwipe).GetChart.Series[0] as Calendar).Date.Month) + ", " + ((label.Element as LabelSwipe).GetChart.Series[0] as Calendar).Date.Year.ToString(); } else if ((label.Element as LabelSwipe).GetChart.Header.Text == "SpecialCalendar" || (label.Element as LabelSwipe).GetChart.Header.Text == "EventCalendar") { label.Element.Text = ((label.Element as LabelSwipe).GetChart.Series[0] as Calendar).Date.ToShortDateString(); } } //label.Element.Text = Convert.ToString(e.Event.GetX() - e.Event.GetY()); /* * if (Convert.ToDouble(label.Element.Text) > 250) { * * ((label.Element as LabelSwipe).GetChart.Series[0] as Calendar).NextMonth(); * * } * else if(Convert.ToDouble(label.Element.Text) < -250) { * * ((label.Element as LabelSwipe).GetChart.Series[0] as Calendar).PreviousMonth(); * * } */ }
public override bool OnTouchEvent(MotionEvent e) { try { dectector.OnTouchEvent(e); switch (e.Action) { case MotionEventActions.Down: mDownX = (int)e.GetX(); mDownY = (int)e.GetY(); mActivePointerId = e.GetPointerId(0); break; case MotionEventActions.Move: if (mActivePointerId == INVALID_POINTER_ID) { break; } int pointerIndex = e.FindPointerIndex(mActivePointerId); mLastEventY = (int)e.GetY(pointerIndex); int deltaY = mLastEventY - mDownY; if (mCellIsMobile) { // Responsible for moving the bitmap drawable to the touch location Enabled = false; mHoverCellCurrentBounds.OffsetTo(mHoverCellOriginalBounds.Left, mHoverCellOriginalBounds.Top + deltaY + mTotalOffset); mHoverCell.SetBounds(mHoverCellCurrentBounds.Left, mHoverCellCurrentBounds.Top, mHoverCellCurrentBounds.Right, mHoverCellCurrentBounds.Bottom); Invalidate(); HandleCellSwitch(); } break; case MotionEventActions.Up: TouchEventsEnded(); break; case MotionEventActions.Cancel: TouchEventsCancelled(); break; default: break; } } catch (Exception ex) { Console.WriteLine("Error Processing OnTouchEvent in DynamicListView.cs - Message: {0}", ex.Message); Console.WriteLine("Error Processing OnTouchEvent in DynamicListView.cs - Stacktrace: {0}", ex.StackTrace); } return(base.OnTouchEvent(e)); }
/// <summary> /// Raises the touch event. /// </summary> /// <param name="v">V.</param> /// <param name="e">E.</param> public bool OnTouch(global::Android.Views.View v, MotionEvent e) { _scaleGestureDetector.OnTouchEvent(e); if (!_scaled) { _gestureDetector.OnTouchEvent(e); } _scaled = false; return(true); }
private void Control_Touch(object sender, TouchEventArgs e) { if (e.Event.PointerCount == 1) { GestureDetector.OnTouchEvent(e.Event); } else { ScaleGestureDetector.OnTouchEvent(e.Event); } }
public bool OnTouch(View nativeView, MotionEvent e) { PreProcessMotionEvent(e); var result = false; if (NativeGestureDetector != null) { result = NativeGestureDetector.OnTouchEvent(e); } PostProcessMotionEvent(e); return(result); }