private static MotionEvent transformEventOld(MotionEvent paramMotionEvent, Matrix paramMatrix) { long l1 = paramMotionEvent.getDownTime(); long l2 = paramMotionEvent.getEventTime(); int i = paramMotionEvent.getAction(); int j = paramMotionEvent.getPointerCount(); int[] arrayOfInt = getPointerIds(paramMotionEvent); MotionEvent.PointerCoords[] arrayOfPointerCoords = getPointerCoords(paramMotionEvent); int k = paramMotionEvent.getMetaState(); float f1 = paramMotionEvent.getXPrecision(); float f2 = paramMotionEvent.getYPrecision(); int l = paramMotionEvent.getDeviceId(); int i1 = paramMotionEvent.getEdgeFlags(); int i2 = paramMotionEvent.getSource(); int i3 = paramMotionEvent.getFlags(); float[] arrayOfFloat = new float[2 * arrayOfPointerCoords.length]; for (int i4 = 0; i4 < j; ++i4) { arrayOfFloat[(i4 * 2)] = arrayOfPointerCoords[i4].x; arrayOfFloat[(1 + i4 * 2)] = arrayOfPointerCoords[i4].y; } paramMatrix.mapPoints(arrayOfFloat); for (int i5 = 0; i5 < j; ++i5) { arrayOfPointerCoords[i5].x = arrayOfFloat[(i5 * 2)]; arrayOfPointerCoords[i5].y = arrayOfFloat[(1 + i5 * 2)]; arrayOfPointerCoords[i5].orientation = transformAngle(paramMatrix, arrayOfPointerCoords[i5].orientation); } return MotionEvent.obtain( l1, l2, i, j, arrayOfInt, arrayOfPointerCoords, k, f1, f2, l, i1, i2, i3); }
@Override public boolean onTouchEvent(MotionEvent ev) { if (isFinished()) return true; if (ev.getAction() != MotionEvent.ACTION_UP) return true; if (mDeviceName == null) { int devId = ev.getDeviceId(); InputDevice dev = InputDevice.getDevice(devId); if (dev != null) { mDeviceName = dev.getName(); } } mTargetPoints[mStep].calx = ev.getRawX() * ev.getXPrecision(); mTargetPoints[mStep].caly = ev.getRawY() * ev.getYPrecision(); mStep++; mContext.onCalTouchEvent(ev); return true; }
private MotionEvent transformEvent(MotionEvent e, int headerPosition) { if (headerPosition == MATCHED_STICKIED_HEADER) { return e; } long downTime = e.getDownTime(); long eventTime = e.getEventTime(); int action = e.getAction(); int pointerCount = e.getPointerCount(); int[] pointerIds = getPointerIds(e); MotionEvent.PointerCoords[] pointerCoords = getPointerCoords(e); int metaState = e.getMetaState(); float xPrecision = e.getXPrecision(); float yPrecision = e.getYPrecision(); int deviceId = e.getDeviceId(); int edgeFlags = e.getEdgeFlags(); int source = e.getSource(); int flags = e.getFlags(); View headerHolder = getChildAt(headerPosition); for (int i = 0; i < pointerCount; i++) { pointerCoords[i].y -= headerHolder.getTop(); } MotionEvent n = MotionEvent.obtain( downTime, eventTime, action, pointerCount, pointerIds, pointerCoords, metaState, xPrecision, yPrecision, deviceId, edgeFlags, source, flags); return n; }
/** * Strips the last pointer from a {@link MotionEvent} and returns the modified event. Does not * modify the original event. * * @param ev The MotionEvent to modify. * @return The modified MotionEvent. */ private MotionEvent stripLastPointer(MotionEvent ev) { ev.getPointerCount(); int removePointer = ev.getPointerCount() - 1; int removePointerId = ev.getPointerId(removePointer); long downTime = ev.getDownTime(); long eventTime = ev.getEventTime(); int action = ev.getAction(); int pointers = ev.getPointerCount() - 1; int[] pointerIds = new int[pointers]; int metaState = ev.getMetaState(); float xPrecision = ev.getXPrecision(); float yPrecision = ev.getYPrecision(); int deviceId = ev.getDeviceId(); int edgeFlags = ev.getEdgeFlags(); switch (ev.getActionMasked()) { case MotionEvent.ACTION_POINTER_DOWN: case MotionEvent.ACTION_POINTER_UP: action -= 0x100; if (pointers == 1) { action -= 0x5; } break; } MotionEvent event = null; if (mCompatibilityMode) { float x = ev.getX(); float y = ev.getY(); float pressure = ev.getPressure(); float size = ev.getSize(); event = MotionEvent.obtain( downTime, eventTime, action, pointers, x, y, pressure, size, metaState, xPrecision, yPrecision, deviceId, edgeFlags); } // XXX commented out to get this to compile ! /* else { PointerCoords[] pointerCoords = new PointerCoords[pointers]; int source = ev.getSource(); int flags = ev.getFlags(); for (int i = 0; i < pointers; i++) { pointerIds[i] = ev.getPointerId(i); pointerCoords[i] = new PointerCoords(); ev.getPointerCoords(i, pointerCoords[i]); } event = MotionEvent.obtain(downTime, eventTime, action, pointers, pointerIds, pointerCoords, metaState, xPrecision, yPrecision, deviceId, edgeFlags, source, flags); } */ return event; }