@Override public boolean dispatchGenericMotionEvent(MotionEvent event) { boolean handled = false; // Check that the event came from a game controller if ((event.getSource() & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK && event.getAction() == MotionEvent.ACTION_MOVE) { // Process all historical movement samples in the batch final int historySize = event.getHistorySize(); // Process the movements starting from the // earliest historical position in the batch for (int i = 0; i < historySize; i++) { // Process the event at historical position i mMain.processJoystickInput(event, i); } // Process the current movement sample in the batch (position -1) handled = mMain.processJoystickInput(event, -1); if (handled) { return true; } else { return super.dispatchGenericMotionEvent(event); } } return handled; } }
@Override public boolean dispatchGenericMotionEvent(MotionEvent event) { boolean handled = false; // Check that the event came from a game controller if ((event.getSource() & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK && event.getAction() == MotionEvent.ACTION_MOVE) { // Process all historical movement samples in the batch final int historySize = event.getHistorySize(); GamepadInput.input(event); // Process the movements starting from the // earliest historical position in the batch for (int i = 0; i < historySize; i++) { // Process the event at historical position i GamepadInput.processJoystickInput(event, i); } // Process the current movement sample in the batch (position -1) handled = GamepadInput.processJoystickInput(event, -1); if (handled) { return true; } else { return super.dispatchGenericMotionEvent(event); } } return handled; }