|
@@ -89,6 +89,7 @@ public class GodotInputHandler implements InputManager.InputDeviceListener, Sens
|
|
|
private int rotaryInputAxis = ROTARY_INPUT_VERTICAL_AXIS;
|
|
|
|
|
|
private int cachedRotation = -1;
|
|
|
+ private boolean overrideVolumeButtons = false;
|
|
|
|
|
|
public GodotInputHandler(Context context, Godot godot) {
|
|
|
this.godot = godot;
|
|
@@ -137,6 +138,10 @@ public class GodotInputHandler implements InputManager.InputDeviceListener, Sens
|
|
|
rotaryInputAxis = axis;
|
|
|
}
|
|
|
|
|
|
+ public void setOverrideVolumeButtons(boolean value) {
|
|
|
+ overrideVolumeButtons = value;
|
|
|
+ }
|
|
|
+
|
|
|
boolean hasHardwareKeyboard() {
|
|
|
return !mHardwareKeyboardIds.isEmpty();
|
|
|
}
|
|
@@ -159,10 +164,6 @@ public class GodotInputHandler implements InputManager.InputDeviceListener, Sens
|
|
|
}
|
|
|
|
|
|
public boolean onKeyUp(final int keyCode, KeyEvent event) {
|
|
|
- if (keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
int source = event.getSource();
|
|
|
if (isKeyEventGameDevice(source)) {
|
|
|
// Check if the device exists
|
|
@@ -180,14 +181,14 @@ public class GodotInputHandler implements InputManager.InputDeviceListener, Sens
|
|
|
handleKeyEvent(physical_keycode, unicode, key_label, false, event.getRepeatCount() > 0);
|
|
|
};
|
|
|
|
|
|
+ if (keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
|
|
|
+ return overrideVolumeButtons;
|
|
|
+ }
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
public boolean onKeyDown(final int keyCode, KeyEvent event) {
|
|
|
- if (keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
int source = event.getSource();
|
|
|
|
|
|
final int deviceId = event.getDeviceId();
|
|
@@ -208,6 +209,10 @@ public class GodotInputHandler implements InputManager.InputDeviceListener, Sens
|
|
|
handleKeyEvent(physical_keycode, unicode, key_label, true, event.getRepeatCount() > 0);
|
|
|
}
|
|
|
|
|
|
+ if (keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
|
|
|
+ return overrideVolumeButtons;
|
|
|
+ }
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|