public boolean onJoystickMotion(MotionEvent event) { StringBuilder message = new StringBuilder(); message.append(mDevice.getName()).append(" - Joystick Motion:\n"); final int historySize = event.getHistorySize(); for (int i = 0; i < mAxes.length; i++) { final int axis = mAxes[i]; final float value = event.getAxisValue(axis); mAxisValues[i] = value; message.append(" ").append(MotionEvent.axisToString(axis)).append(": "); // Append all historical values in the batch. for (int historyPos = 0; historyPos < historySize; historyPos++) { message.append(event.getHistoricalAxisValue(axis, historyPos)); message.append(", "); } // Append the current value. message.append(value); message.append("\n"); } Log.i(TAG, message.toString()); return true; }
public boolean onJoystickMotion(MotionEvent event) { StringBuilder message = new StringBuilder(); message.append(mDevice.getName()).append(" - Joystick Motion:\n"); final int historySize = event.getHistorySize(); for (int i = 0; i < mAxes.length; i++) { final int axis = mAxes[i]; final float value = event.getAxisValue(axis); mAxisValues[i] = value; message.append(" ").append(MotionEvent.axisToString(axis)).append(": "); // Append all historical values in the batch. for (int historyPos = 0; historyPos < historySize; historyPos++) { message.append(event.getHistoricalAxisValue(axis, historyPos)); message.append(", "); } // Append the current value. message.append(value); message.append("\n"); } Log.i(TAG, message.toString()); return true; }
private static float getCenteredAxis(MotionEvent event, InputDevice device, int axis, int historyPos) { final InputDevice.MotionRange range = device.getMotionRange(axis, event.getSource()); // A joystick at rest does not always report an absolute position of // (0,0). Use the getFlat() method to determine the range of values // bounding the joystick axis center. if (range != null) { final float flat = range.getFlat(); final float value = historyPos < 0 ? event.getAxisValue(axis): event.getHistoricalAxisValue(axis, historyPos); // Ignore axis values that are within the 'flat' region of the // joystick axis center. if (Math.abs(value) > flat) { return value; } } return 0; }
private static float getCenteredAxis(MotionEvent event, InputDevice device, int axis, int historyPos) { final InputDevice.MotionRange range = device.getMotionRange(axis, event.getSource()); if (range != null) { final float flat = range.getFlat(); final float value = historyPos < 0 ? event.getAxisValue(axis) : event.getHistoricalAxisValue(axis, historyPos); // Ignore axis values that are within the 'flat' region of the joystick axis center. // A joystick at rest does not always report an absolute position of (0,0). if (Math.abs(value) > flat) { return value; } } return 0; }
private static float getCenteredAxis(MotionEvent event, InputDevice device, int axis, int historyPos) { final InputDevice.MotionRange range = device.getMotionRange(axis, event.getSource()); if (range != null) { final float flat = range.getFlat(); final float value = historyPos < 0 ? event.getAxisValue(axis) : event.getHistoricalAxisValue(axis, historyPos); // Ignore axis values that are within the 'flat' region of the joystick axis center. // A joystick at rest does not always report an absolute position of (0,0). if (Math.abs(value) > flat) { return value; } } return 0; }
private static float getCenteredAxis(MotionEvent event, InputDevice device, int axis, int historyPos) { final InputDevice.MotionRange range = device.getMotionRange(axis, event.getSource()); if (range != null) { final float flat = range.getFlat(); final float value = historyPos < 0 ? event.getAxisValue(axis) : event.getHistoricalAxisValue(axis, historyPos); // Ignore axis values that are within the 'flat' region of the // joystick axis center. // A joystick at rest does not always report an absolute position of // (0,0). if (Math.abs(value) > flat) { return value; } } return 0; }
private static float getCenteredAxis(MotionEvent event, InputDevice device, int axis, int historyPos) { final InputDevice.MotionRange range = device.getMotionRange(axis, event.getSource()); // A joystick at rest does not always report an absolute position of // (0,0). Use the getFlat() method to determine the range of values // bounding the joystick axis center. if (range != null) { final float flat = range.getFlat(); final float value = historyPos < 0 ? event.getAxisValue(axis) : event.getHistoricalAxisValue(axis, historyPos); // Ignore axis values that are within the 'flat' region of the // joystick axis center. if (Math.abs(value) > flat) { return value; } } return 0; }
private static float getCenteredAxis(MotionEvent event, InputDevice device, int axis, int historyPos) { final InputDevice.MotionRange range = device.getMotionRange(axis, event.getSource()); // A joystick at rest does not always report an absolute position of // (0,0). Use the getFlat() method to determine the range of values // bounding the joystick axis center. if (range != null) { final float flat = range.getFlat(); final float value = historyPos < 0 ? event.getAxisValue(axis) : event.getHistoricalAxisValue(axis, historyPos); // Ignore axis values that are within the 'flat' region of the // joystick axis center. if (Math.abs(value) > flat) { return value; } } return 0; }
event.getHistoricalTouchMinor(j, i), event.getHistoricalOrientation(j, i), event.getHistoricalAxisValue(MotionEvent.AXIS_DISTANCE, j, i), event.getHistoricalAxisValue(MotionEvent.AXIS_TILT, j, i));
event.getHistoricalTouchMinor(j, i), event.getHistoricalOrientation(j, i), event.getHistoricalAxisValue(MotionEvent.AXIS_DISTANCE, j, i), event.getHistoricalAxisValue(MotionEvent.AXIS_TILT, j, i));