List of usage examples for com.facebook.react.uimanager.events TouchEventType END
TouchEventType END
To view the source code for com.facebook.react.uimanager.events TouchEventType END.
Click Source Link
From source file:com.horcrux.svg.RNSVGSvgView.java
License:Open Source License
public void handleTouchEvent(MotionEvent ev, EventDispatcher eventDispatcher) { int action = ev.getAction() & MotionEvent.ACTION_MASK; if (action == MotionEvent.ACTION_DOWN) { eventDispatcher.dispatchEvent(TouchEvent.obtain(mTargetTag, SystemClock.nanoTime(), TouchEventType.START, ev, ev.getX(), ev.getX(), mTouchEventCoalescingKeyHelper)); } else if (mTargetTag == -1) { // All the subsequent action types are expected to be called after ACTION_DOWN thus target // is supposed to be set for them. Log.e("error", "Unexpected state: received touch event but didn't get starting ACTION_DOWN for this " + "gesture before"); } else if (action == MotionEvent.ACTION_UP) { // End of the gesture. We reset target tag to -1 and expect no further event associated with // this gesture. eventDispatcher.dispatchEvent(TouchEvent.obtain(mTargetTag, SystemClock.nanoTime(), TouchEventType.END, ev, ev.getX(), ev.getY(), mTouchEventCoalescingKeyHelper)); mTargetTag = -1;//from w w w . j ava 2s. c o m } else if (action == MotionEvent.ACTION_MOVE) { // Update pointer position for current gesture eventDispatcher.dispatchEvent(TouchEvent.obtain(mTargetTag, SystemClock.nanoTime(), TouchEventType.MOVE, ev, ev.getX(), ev.getY(), mTouchEventCoalescingKeyHelper)); } else if (action == MotionEvent.ACTION_POINTER_DOWN) { // New pointer goes down, this can only happen after ACTION_DOWN is sent for the first pointer eventDispatcher.dispatchEvent(TouchEvent.obtain(mTargetTag, SystemClock.nanoTime(), TouchEventType.START, ev, ev.getX(), ev.getY(), mTouchEventCoalescingKeyHelper)); } else if (action == MotionEvent.ACTION_POINTER_UP) { // Exactly onw of the pointers goes up eventDispatcher.dispatchEvent(TouchEvent.obtain(mTargetTag, SystemClock.nanoTime(), TouchEventType.END, ev, ev.getX(), ev.getY(), mTouchEventCoalescingKeyHelper)); } else if (action == MotionEvent.ACTION_CANCEL) { dispatchCancelEvent(ev, eventDispatcher); mTargetTag = -1; } else { Log.w("IGNORE", "Warning : touch event was ignored. Action=" + action + " Target=" + mTargetTag); } }
From source file:com.horcrux.svg.SvgView.java
License:Open Source License
public void handleTouchEvent(MotionEvent ev) { int action = ev.getAction() & MotionEvent.ACTION_MASK; if (action == MotionEvent.ACTION_DOWN) { dispatch(ev, TouchEventType.START); } else if (mTargetTag == -1) { // All the subsequent action types are expected to be called after ACTION_DOWN thus target // is supposed to be set for them. Log.e("error", "Unexpected state: received touch event but didn't get starting ACTION_DOWN for this " + "gesture before"); } else if (action == MotionEvent.ACTION_UP) { // End of the gesture. We reset target tag to -1 and expect no further event associated with // this gesture. dispatch(ev, TouchEventType.END); mTargetTag = -1;//from w ww .ja v a 2s . c o m } else if (action == MotionEvent.ACTION_MOVE) { // Update pointer position for current gesture dispatch(ev, TouchEventType.MOVE); } else if (action == MotionEvent.ACTION_POINTER_DOWN) { // New pointer goes down, this can only happen after ACTION_DOWN is sent for the first pointer dispatch(ev, TouchEventType.START); } else if (action == MotionEvent.ACTION_POINTER_UP) { // Exactly onw of the pointers goes up dispatch(ev, TouchEventType.END); mTargetTag = -1; } else if (action == MotionEvent.ACTION_CANCEL) { dispatchCancelEvent(ev); mTargetTag = -1; } else { Log.w("IGNORE", "Warning : touch event was ignored. Action=" + action + " Target=" + mTargetTag); } }