public override bool OnInterceptTouchEvent(MotionEvent ev) { // verify from our parent we can scroll, and that scrolling is enabled if( Notes.OnInterceptTouchEvent( ev ) && ScrollEnabled == true ) { return base.OnInterceptTouchEvent(ev); } return false; }
public virtual bool onHover(View v, MotionEvent @event) { if (@event.Action == MotionEvent.ACTION_HOVER_MOVE) { if ((@event.ButtonState & MotionEvent.BUTTON_SECONDARY) != 0) { outerInstance.mAirButton.show(@event); } } return false; }
public virtual bool onHover(View v, MotionEvent @event) { if (@event.Action == MotionEvent.ACTION_HOVER_MOVE) { if ((@event.ButtonState & MotionEvent.BUTTON_SECONDARY) != 0) { Log.e("newkkc79","event"); } } return false; }
public bool OnDown(MotionEvent e) { return(true); }
public void OnLongPress(MotionEvent e) { _gestureManager.OnLongPress(e); }
public override bool OnFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { bool result = false; try { float diffY = e2.GetY() - e1.GetY(); float diffX = e2.GetX() - e1.GetX(); if (Math.Abs(diffX) > Math.Abs(diffY)) { if (Math.Abs(diffX) > SWIPE_THRESHOLD && Math.Abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) { if (diffX > 0) { result = listener.OnSwipeRight(); } else { result = listener.OnSwipeLeft(); } } } else { if (Math.Abs(diffY) > SWIPE_THRESHOLD && Math.Abs(velocityY) > SWIPE_VELOCITY_THRESHOLD) { if (diffY > 0) { result = listener.OnSwipeBottom(); } else { result = listener.OnSwipeTop(); } } } } catch (Exception exception) { // exception.PrintStackTrace(); } return result; }
private string buildInputPackage(KeyCode key, Device device) { KeyEvent keyEvent = new KeyEvent(); keyEvent.mAction = 0; keyEvent.mDeviceId = device.id; keyEvent.mDownTime = 0; keyEvent.mFlags = 0; keyEvent.mRepeatCount = 0; keyEvent.mKeyCode = OuyaControllerMapping.findButton((int)key, OuyaInputManager.GetControllerType(device.name)); keyEvent.mMetaState = 0; keyEvent.mScanCode = 0; keyEvent.mSource = 0; keyEvent.mSeq = 0; keyEvent.mEventTime = 0; keyEvent.mDownTime = 0; keyEvent.mRecycled = false; MotionEvent motionEvent = new MotionEvent(); InputContainer inputContainer = new InputContainer(); inputContainer.KeyEvent = keyEvent; inputContainer.MotionEvent = motionEvent; inputContainer.DeviceId = device.id; inputContainer.DeviceName = device.name; string jsonData = JsonMapper.ToJson(inputContainer); return jsonData; }
public override bool onTouchEvent(MotionEvent @event) { float x = @event.X - CENTER_X; float y = @event.Y - CENTER_Y; bool inCenter = Math.Sqrt(x * x + y * y) <= CENTER_RADIUS; switch (@event.Action) { case MotionEvent.ACTION_DOWN: mTrackingCenter = inCenter; if (inCenter) { mHighlightCenter = true; invalidate(); break; } case MotionEvent.ACTION_MOVE: if (mTrackingCenter) { if (mHighlightCenter != inCenter) { mHighlightCenter = inCenter; invalidate(); } } else { float angle = (float) Math.Atan2(y, x); // need to turn angle [-PI ... PI] into unit [0....1] float unit = angle / (2 * PI); if (unit < 0) { unit += 1; } mCenterPaint.Color = interpColor(mColors, unit); invalidate(); } break; case MotionEvent.ACTION_UP: if (mTrackingCenter) { if (inCenter) { mListener.colorChanged(mCenterPaint.Color); } mTrackingCenter = false; // so we draw w/o halo invalidate(); } break; } return true; }
public override void OnUp( MotionEvent e ) { base.OnUp( e ); // ignore Up gestures. Do not reveal the nav toolbar. }
public override bool OnTouch( View v, MotionEvent e ) { // check to see if we should monitor navBar reveal if ( e.Action == MotionEventActions.Down ) { NavBarRevealTracker.BeginTracking( ScrollView.ScrollY ); } if ( base.OnTouch( v, e ) == true ) { return true; } else { switch ( e.Action ) { case MotionEventActions.Move: { // if at any point during a move the task is no longer allowed to receive input, // STOP SCROLLING. It means the user began panning out the view if ( ParentTask.NavbarFragment.ShouldTaskAllowInput( ) == false ) { ScrollView.ScrollEnabled = false; } if ( Note != null ) { Note.TouchesMoved( new System.Drawing.PointF( e.GetX( ), e.GetY( ) ) ); } break; } case MotionEventActions.Up: { if ( Note != null ) { AnimateTutorialScreen( false ); string activeUrl = Note.TouchesEnded( new System.Drawing.PointF( e.GetX( ), e.GetY( ) ) ); // again, only process this if we didn't create a note. We don't want to treat a double tap // like a request to view a note if ( DidGestureCreateNote == false ) { if ( string.IsNullOrEmpty( activeUrl ) == false ) { ParentTask.OnClick( this, 0, activeUrl ); } } } ScrollView.ScrollEnabled = true; MovingUserNote = false; DidGestureCreateNote = false; break; } } } return false; }
public override bool onInterceptTouchEvent(RecyclerView recyclerView, MotionEvent motionEvent) { return true; }
public override bool DispatchTouchEvent(MotionEvent e) { NativePanel?.TrackMotionDirections(e); return(base.DispatchTouchEvent(e)); }
public override bool OnTouchEvent(MotionEvent e) { return(_gestureManager.OnTouchEvent(e) || base.OnTouchEvent(e)); }
public bool OnFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { }
public bool OnDown(MotionEvent e) { }
public bool OnScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { }
public override bool OnTouch( View v, MotionEvent e ) { MediaController.Show( ); return false; }
public bool OnInterceptTouchEvent(MotionEvent ev) { // called by the LockableScrollView. This allows us to shut the // springboard if it's open and the user touches the note. if ( MainActivity.IsLandscapeWide( ) == false ) { if ( ParentTask.NavbarFragment.ShouldSpringboardAllowInput( ) ) { ParentTask.NavbarFragment.RevealSpringboard( false ); return false; } } // if we get any touch input whatsoever, lose the tutorial screen AnimateTutorialScreen( false ); return true; }
public override bool OnDownGesture( MotionEvent e ) { // only processes TouchesBegan if we didn't create a note with this gesture. if ( DidGestureCreateNote == false ) { if ( Note != null ) { if ( Note.TouchesBegan( new System.Drawing.PointF( e.GetX( ), e.GetY( ) ) ) ) { ScrollView.ScrollEnabled = false; MovingUserNote = true; } } } return false; }
public override void onTouchEvent(RecyclerView recyclerView, MotionEvent motionEvent) { // NOOP }
public bool OnSingleTapUp(MotionEvent e) { _gestureManager.OnSingleTapUp(e); return(true); }
public override bool OnTouchEvent(MotionEvent e) { //System.Diagnostics.Debug.WriteLine("============================================================="); //System.Diagnostics.Debug.WriteLine("NativeGestureDetector.OnTouchEvent e.Action=[" + e.Action + "]"); bool handled = base.OnTouchEvent(e); //System.Diagnostics.Debug.WriteLine("NativeGestureDetector.OnTouchEvent handled=" + handled); if (e.PointerCount > 1 && _listener != null) { // multi point gesture ? bool[] valid = new bool[6]; MotionEvent.PointerCoords[] coords = new MotionEvent.PointerCoords[6]; for (int i = 0; i < Math.Min(e.PointerCount, 6); i++) { coords[i] = new MotionEvent.PointerCoords(); var index = e.FindPointerIndex(i); if (index > -1 && index < 6) { valid[index] = true; e.GetPointerCoords(index, coords[i]); if (_lastCoords != null && _lastCoords[i] != null) { _avgCoords[i].X = (float)((coords[i].X + _lastCoords[i].X) / 2.0); _avgCoords[i].Y = (float)((coords[i].Y + _lastCoords[i].Y) / 2.0); } _lastCoords = coords; } } if (e.Action == MotionEventActions.Down || e.Action == MotionEventActions.Pointer1Down || e.Action == MotionEventActions.Pointer2Down) { handled = handled || _listener.OnMultiDown(e, _lastCoords); } else if (e.Action == MotionEventActions.Move) { handled = handled || _listener.OnMultiMove(e, _avgCoords); } else if (e.Action == MotionEventActions.Cancel || e.Action == MotionEventActions.Up || e.Action == MotionEventActions.Pointer1Up || e.Action == MotionEventActions.Pointer2Up) { handled = handled || _listener.OnMultiUp(e, _avgCoords); _lastCoords = null; } } // the following line was once needed but now it seems to cause double "UPS" to be called when used with Bc3.Forms.KeypadButton; //else if (e.ActionMasked == MotionEventActions.Up || e.ActionMasked == MotionEventActions.Pointer1Up || (e.Action == MotionEventActions.Down && _lastMotionEvent != null && _lastMotionEvent.Action == MotionEventActions.Down)) else if (e.ActionMasked == MotionEventActions.Up || e.ActionMasked == MotionEventActions.Pointer1Up) { _listener?.OnUp(e); } else if (e.Action == MotionEventActions.Cancel) { _listener?.Cancel(e); } else if (e.Action == MotionEventActions.Move) { handled = handled || _listener.HandlesMove; } _lastMotionEvent = e; //System.Diagnostics.Debug.WriteLine("NativeGestureDetector.OnTouchEvent handled=" + handled); return(handled); }
public override bool onTouchEvent(MotionEvent e) { if (e != null) { float x = e.getX(); float y = e.getY(); var MotionEvent_ACTION_MOVE = 7; if (e.getAction() == MotionEvent_ACTION_MOVE) { float deltaX = (x - mPreviousX) / mDensity / 2f; float deltaY = (y - mPreviousY) / mDensity / 2f; if (ontouchmove != null) ontouchmove(deltaX, deltaY); //mRenderer.mDeltaX += deltaX; //mRenderer.mDeltaY += deltaY; } mPreviousX = x; mPreviousY = y; return true; } return base.onTouchEvent(e); }
public bool OnTouch(View v, MotionEvent e) { mCircleMenuLayout.dispatchTouchEvent(e); return(true); }
public override bool onTouchEvent(MotionEvent @event) { int action = MotionEventCompat.getActionMasked(@event); switch (action) { case (MotionEvent.ACTION_DOWN): mMute = !mMute; if (mListener != null) { mListener.onClick(this); } return true; default: return base.onTouchEvent(@event); } }
public override bool OnTouchEvent(MotionEvent motionEvent) { if (motionEvent.Action != MotionEventActions.Down && motionEvent.Action != MotionEventActions.Move) { return(false); } var newBall = AddBall(motionEvent.GetX(), motionEvent.GetY()); // Bouncing animation with squash and stretch var startY = newBall.Y; var endY = Height - 50f; var h = (float)Height; var eventY = motionEvent.GetY(); var duration = (int)(500 * ((h - eventY) / h)); var bounceAnim = ObjectAnimator.OfFloat(newBall, "y", startY, endY); bounceAnim.SetDuration(duration); bounceAnim.SetInterpolator(new AccelerateInterpolator()); var squashAnim1 = ObjectAnimator.OfFloat(newBall, "x", newBall.X, newBall.X - 25f); squashAnim1.SetDuration(duration / 4); squashAnim1.RepeatCount = 1; squashAnim1.RepeatMode = ValueAnimatorRepeatMode.Reverse; squashAnim1.SetInterpolator(new DecelerateInterpolator()); var squashAnim2 = ObjectAnimator.OfFloat(newBall, "width", newBall.Width, newBall.Width + 50); squashAnim2.SetDuration(duration / 4); squashAnim2.RepeatCount = 1; squashAnim2.RepeatMode = ValueAnimatorRepeatMode.Reverse; squashAnim2.SetInterpolator(new DecelerateInterpolator()); var stretchAnim1 = ObjectAnimator.OfFloat(newBall, "y", endY, endY + 25f); stretchAnim1.SetDuration(duration / 4); stretchAnim1.RepeatCount = 1; stretchAnim1.SetInterpolator(new DecelerateInterpolator()); stretchAnim1.RepeatMode = ValueAnimatorRepeatMode.Reverse; var stretchAnim2 = ObjectAnimator.OfFloat(newBall, "height", newBall.Height, newBall.Height - 25); stretchAnim2.SetDuration(duration / 4); stretchAnim2.RepeatCount = 1; stretchAnim2.SetInterpolator(new DecelerateInterpolator()); stretchAnim2.RepeatMode = ValueAnimatorRepeatMode.Reverse; var bounceBackAnim = ObjectAnimator.OfFloat(newBall, "y", endY, startY); bounceBackAnim.SetDuration(duration); bounceBackAnim.SetInterpolator(new DecelerateInterpolator()); // Sequence the down/squash&stretch/up animations var bouncer = new AnimatorSet(); bouncer.Play(bounceAnim).Before(squashAnim1); bouncer.Play(squashAnim1).With(squashAnim2); bouncer.Play(squashAnim1).With(stretchAnim1); bouncer.Play(squashAnim1).With(stretchAnim2); bouncer.Play(bounceBackAnim).After(stretchAnim2); // Fading animation - remove the ball when the animation is done var fadeAnim = ObjectAnimator.OfFloat(newBall, "alpha", 1f, 0f); fadeAnim.SetDuration(250); fadeAnim.AnimationEnd += (sender, e) => { var animator = (ObjectAnimator)e.Animation; balls.Remove((ShapeHolder)animator.Target); }; // Sequence the two animations to play one after the other var animatorSet = new AnimatorSet(); animatorSet.Play(bouncer).Before(fadeAnim); // Start the animation animatorSet.Start(); return(true); }
public override bool onDoubleTap(MotionEvent e) { return true; }
public bool dispatchTouchEvent(MotionEvent ev) { float x = ev.GetX(); float y = ev.GetY(); switch (ev.Action) { case MotionEventActions.Down: mLastX = x; mLastY = y; mDownTime = Java.Lang.JavaSystem.CurrentTimeMillis(); mTmpAngle = 0; if (isFling) { RemoveCallbacks(mFlingRunnable); isFling = false; return(true); } break; case MotionEventActions.Move: float start = getAngle(mLastX, mLastY); float end = getAngle(x, y); // Log.e("TAG", "start = " + start + " , end =" + end); if (getQuadrant(x, y) == 1 || getQuadrant(x, y) == 4) { mStartAngle += end - start; mTmpAngle += end - start; } else { mStartAngle += start - end; mTmpAngle += start - end; } RequestLayout(); mLastX = x; mLastY = y; break; case MotionEventActions.Up: float anglePerSecond2 = mTmpAngle * 1000 / (Java.Lang.JavaSystem.CurrentTimeMillis() - mDownTime); // Log.e("TAG", anglePrMillionSecond + " , mTmpAngel = " + // mTmpAngle); if (Math.Abs(anglePerSecond2) > mFlingableValue && !isFling) { Post(mFlingRunnable = (AutoFlingRunnable(anglePerSecond2))); return(true); } if (Math.Abs(mTmpAngle) > NOCLICK_VALUE) { return(true); } break; } return(true); // return base.DispatchTouchEvent(ev); }
protected void HandleInProgressEvent(int p0, MotionEvent p1) { throw new NotImplementedException(); }
public bool onTouchEvent(MotionEvent ev) { return(true); }
public bool OnSingleTapUp(MotionEvent e) { _onClick(); return(false); }
bool GestureDetector.IOnGestureListener.OnFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { EndScrolling(); return(false); }
public bool OnFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { return(false); }
void GestureDetector.IOnGestureListener.OnLongPress(MotionEvent e) { SetStartingPosition(e); _dragAndDropGestureHandler.OnLongPress(e); }
public override bool OnDoubleTap(MotionEvent e) { // a double tap CAN create a user note. If it did, // we want to know that so we suppress further input until we receive // TouchUp try { DidGestureCreateNote = Note.DidDoubleTap( new System.Drawing.PointF( e.GetX( ), e.GetY( ) ) ); } catch( Exception ex ) { Springboard.DisplayError( "Notes", ex.Message ); DidGestureCreateNote = false; } return true; }
public override bool onTouchEvent(MotionEvent e) { // cannot override onTouchEvent(MotionEvent) in Activity var x = base.onTouchEvent(e); if (e.getAction() == MotionEvent.ACTION_OUTSIDE) if (AtTouchOutside != null) AtTouchOutside(); return x; }
public override bool OnScrollGesture( MotionEvent e1, MotionEvent e2, float distanceX, float distanceY ) { // if we're moving a user note, consume the input so that the // springboard doesn't receive this, and thus doesn't pan. if ( MovingUserNote == true ) { return true; } else { return base.OnScrollGesture( e1, e2, distanceX, distanceY ); } }
public void ForceHandleTouchEvent(MotionEvent e) { base.OnTouchEvent(e); }
void GestureDetector.IOnGestureListener.OnShowPress(MotionEvent e) { }
public bool OnScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { _gestureManager.OnScroll(e1, e2, distanceX, distanceY); return(true); }
public override bool OnTouchEvent(MotionEvent e) { if (Parent is ViewWrapper) { return (Parent as ViewWrapper).OnTouchEvent(e) || IgnoreTouchEvents || base.OnTouchEvent(e); } else { return base.OnTouchEvent(e); } }
void SetStartingPosition(MotionEvent e1) { _lastX = e1.GetX(); _lastY = e1.GetY(); }
bool GestureDetector.IOnDoubleTapListener.OnDoubleTapEvent(MotionEvent e) { return(false); }
public bool OnDown(MotionEvent e) { return(false); }
/// <summary> /// MOGA Controller motion event /// </summary> /// <param name="e">Motion event args</param> public void OnMotionEvent(MotionEvent e) { Debug.WriteLine("Controller motion event"); // TODO }
// Gestures public override bool OnTouchEvent(MotionEvent e) { gestureDetector.OnTouchEvent(e); return(true); }
public override bool onTouchEvent(MotionEvent @event) { float x = @event.X; float y = @event.Y; switch (@event.Action) { case MotionEvent.ACTION_DOWN: onTouchStart(x, y); invalidate(); break; case MotionEvent.ACTION_MOVE: onTouchMove(x, y); invalidate(); break; case MotionEvent.ACTION_UP: onTouchEnd(); invalidate(); break; } return true; }
public bool OnSingleTapUp(MotionEvent e) { return(false); }
public static MotionEvent Obtain(long downTime, long eventTime, int action, int pointers, int[] pointerIds, MotionEvent.PointerCoords[] pointerCoords, MetaKeyStates metaState, float xPrecision, float yPrecision, int deviceId, Edge edgeFlags, int source, int flags) { return Obtain (downTime, eventTime, (MotionEventActions) action, pointers, pointerIds, pointerCoords, metaState, xPrecision, yPrecision, deviceId, edgeFlags, (InputSourceType) source, (MotionEventFlags) flags); }
public override bool DispatchTouchEvent(MotionEvent ev) { var searchBar = FindViewById <EditText>(Resource.Id.searchBar); if (searchBar != null) { if (ev.Action == MotionEventActions.Down) { View v = CurrentFocus; if (searchBar.IsFocused) { Rect outRect = new Rect(); searchBar.GetGlobalVisibleRect(outRect); if (!outRect.Contains((int)ev.RawX, (int)ev.RawY)) { searchBar.ClearFocus(); // // Hide keyboard // InputMethodManager imm = (InputMethodManager)v.Context.GetSystemService(InputMethodService); imm.HideSoftInputFromWindow(v.WindowToken, 0); } } } } var searchReportsBar = FindViewById <EditText>(Resource.Id.searchReportsBar); if (searchReportsBar != null) { if (ev.Action == MotionEventActions.Down) { View v = CurrentFocus; if (searchReportsBar.IsFocused) { Rect outRect = new Rect(); searchReportsBar.GetGlobalVisibleRect(outRect); if (!outRect.Contains((int)ev.RawX, (int)ev.RawY)) { searchReportsBar.ClearFocus(); // // Hide keyboard // InputMethodManager imm = (InputMethodManager)v.Context.GetSystemService(InputMethodService); imm.HideSoftInputFromWindow(v.WindowToken, 0); } } } } var searchUserBar = FindViewById <EditText>(Resource.Id.searchUserBar); if (searchUserBar != null && ev.Action == MotionEventActions.Down) { View v = CurrentFocus; if (searchUserBar.IsFocused) { Rect outRect = new Rect(); searchUserBar.GetGlobalVisibleRect(outRect); if (!outRect.Contains((int)ev.RawX, (int)ev.RawY)) { searchUserBar.ClearFocus(); InputMethodManager imm = (InputMethodManager)v.Context.GetSystemService(InputMethodService); imm.HideSoftInputFromWindow(v.WindowToken, 0); } } } return(base.DispatchTouchEvent(ev)); }
public override void OnUp( MotionEvent e ) { base.OnUp( e ); }
public virtual Point GetAvaloniaPointFromEvent(MotionEvent e, int pointerIndex) => new Point(e.GetX(pointerIndex), e.GetY(pointerIndex)) / RenderScaling;
public override bool onTouch(View arg0, MotionEvent arg1) { if (arg1.Action == MotionEvent.ACTION_DOWN) { long thisTime = DateTimeHelperClass.CurrentUnixTimeMillis(); if (thisTime - lastTouchTime < 250) { // Double tap mGesture.onTouchEvent(arg1); lastTouchTime = -1; return true; } else { // Too slow lastTouchTime = thisTime; } } return false; }
public void OnLongPress(MotionEvent e) { }
public bool OnTouch(View v, MotionEvent @event) { gestureDetector.OnTouchEvent(@event); return true; }
public bool OnScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { return(false); }
protected void HandleStartProgressEvent(int p0, MotionEvent p1) { return; }
public void OnShowPress(MotionEvent e) { }
public override bool onTouch(View v, MotionEvent @event) { outerInstance.showMsgNotification(false); outerInstance.mListView.smoothScrollToPosition(outerInstance.mMessageAdapter.MessagesList.Count - 1); return false; }
public bool OnDown(MotionEvent e) { _gestureManager.OnDown(e); return(true); }