Java Code Examples for androidx.core.view.MotionEventCompat#getPointerCount()
The following examples show how to use
androidx.core.view.MotionEventCompat#getPointerCount() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ViewDragHelper.java From react-native-photo-editor with Apache License 2.0 | 5 votes |
private void saveLastMotion(MotionEvent ev) { final int pointerCount = MotionEventCompat.getPointerCount(ev); for (int i = 0; i < pointerCount; i++) { final int pointerId = MotionEventCompat.getPointerId(ev, i); final float x = MotionEventCompat.getX(ev, i); final float y = MotionEventCompat.getY(ev, i); // Sometimes we can try and save last motion for a pointer never recorded in initial motion. In this case we just discard it. if (mLastMotionX != null && mLastMotionY != null && mLastMotionX.length > pointerId && mLastMotionY.length > pointerId) { mLastMotionX[pointerId] = x; mLastMotionY[pointerId] = y; } } }
Example 2
Source File: ViewDragHelper.java From NewFastFrame with Apache License 2.0 | 5 votes |
private void saveLastMotion(MotionEvent ev) { final int pointerCount = MotionEventCompat.getPointerCount(ev); for (int i = 0; i < pointerCount; i++) { final int pointerId = MotionEventCompat.getPointerId(ev, i); final float x = MotionEventCompat.getX(ev, i); final float y = MotionEventCompat.getY(ev, i); // Sometimes we can try and save last motion for a pointer never recorded in initial motion. In this case we just discard it. if (mLastMotionX != null && mLastMotionY != null && mLastMotionX.length > pointerId && mLastMotionY.length > pointerId) { mLastMotionX[pointerId] = x; mLastMotionY[pointerId] = y; } } }
Example 3
Source File: ViewDragHelper.java From AndroidAnimationExercise with Apache License 2.0 | 5 votes |
private void saveLastMotion(MotionEvent ev) { final int pointerCount = MotionEventCompat.getPointerCount(ev); for (int i = 0; i < pointerCount; i++) { final int pointerId = MotionEventCompat.getPointerId(ev, i); final float x = MotionEventCompat.getX(ev, i); final float y = MotionEventCompat.getY(ev, i); // Sometimes we can try and save last motion for a pointer never recorded in initial motion. In this case we just discard it. if (mLastMotionX != null && mLastMotionY != null && mLastMotionX.length > pointerId && mLastMotionY.length > pointerId) { mLastMotionX[pointerId] = x; mLastMotionY[pointerId] = y; } } }
Example 4
Source File: ViewDragHelper.java From toktok-android with GNU General Public License v3.0 | 5 votes |
private void saveLastMotion(@NonNull MotionEvent ev) { final int pointerCount = MotionEventCompat.getPointerCount(ev); for (int i = 0; i < pointerCount; i++) { final int pointerId = MotionEventCompat.getPointerId(ev, i); final float x = MotionEventCompat.getX(ev, i); final float y = MotionEventCompat.getY(ev, i); // Sometimes we can try and save last motion for a pointer never recorded in initial motion. In this case we just discard it. if (mLastMotionX != null && mLastMotionY != null && mLastMotionX.length > pointerId && mLastMotionY.length > pointerId) { mLastMotionX[pointerId] = x; mLastMotionY[pointerId] = y; } } }
Example 5
Source File: ViewDragHelper.java From hipda with GNU General Public License v2.0 | 5 votes |
private void saveLastMotion(MotionEvent ev) { final int pointerCount = MotionEventCompat.getPointerCount(ev); for (int i = 0; i < pointerCount; i++) { final int pointerId = MotionEventCompat.getPointerId(ev, i); final float x = MotionEventCompat.getX(ev, i); final float y = MotionEventCompat.getY(ev, i); mLastMotionX[pointerId] = x; mLastMotionY[pointerId] = y; } }