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); }
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; }
private void logMotionEvent(MotionEvent event, boolean gen) { String s = gen ? "GenericMotionEvent from " : "TouchEvent from "; s += printDevice(event.getDeviceId()) + " source " + printSource(event.getSource()); int pointerCount = event.getPointerCount(); String action; switch (event.getActionMasked()) { case MotionEvent.ACTION_CANCEL: action = "cancel"; break; case MotionEvent.ACTION_DOWN: action = "down"; break; case MotionEvent.ACTION_HOVER_ENTER: action = "hover_enter"; break; case MotionEvent.ACTION_HOVER_EXIT: action = "hover_exit"; break; case MotionEvent.ACTION_HOVER_MOVE: action = "hover_move"; break; case MotionEvent.ACTION_MOVE: action = "move"; break; case MotionEvent.ACTION_OUTSIDE: action = "outside"; break; case MotionEvent.ACTION_POINTER_DOWN: action = "pointer_down"; break; case MotionEvent.ACTION_POINTER_UP: action = "pointer_up"; break; case MotionEvent.ACTION_UP: action = "up"; break; case MotionEvent.ACTION_SCROLL: action = "scroll"; break; default: action = "" + event.getAction(); break; } s += ", action " + action + " pointer count " + pointerCount + " buttons " + event.getButtonState() + " RawX " + event.getRawX() + " RawY " + event.getRawY() + " MetaState " + event.getMetaState() + " Flags " + event.getFlags() + "\n"; for (int p = 0; p < pointerCount; p++) { int ptrId = event.getPointerId(p); s += "Pointer id " + ptrId + " X " + event.getX(p) + " Y " + event.getY(p) + " pressure " + event.getPressure(p) + " size " + event.getSize(p) + " orientation " + event.getOrientation(p) + // (float)Math.toDegrees(event.getOrientation(p)) + " TouchMajor " + event.getTouchMajor(p) + " TouchMinor " + event.getTouchMinor(p) + " ToolMajor " + event.getToolMajor(p) + " ToolMinor " + event.getToolMinor(p) + "\n"; for (int i = 0; i < 255; i++) { if (event.getAxisValue(i, p) != 0.0) { s += "Axis " + i + " " + event.axisToString(i) + ": " + event.getAxisValue(i, p); InputDevice device = InputDevice.getDevice(event.getDeviceId()); if (device != null) { InputDevice.MotionRange range = device.getMotionRange(i); if (range != null) s += " range " + range.getMin() + " to " + range.getMax(); } s += "\n"; } } } pushText(s); }