|
@@ -88,6 +88,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;
|
|
@@ -136,6 +137,10 @@ public class GodotInputHandler implements InputManager.InputDeviceListener, Sens
|
|
|
rotaryInputAxis = axis;
|
|
|
}
|
|
|
|
|
|
+ public void setOverrideVolumeButtons(boolean value) {
|
|
|
+ overrideVolumeButtons = value;
|
|
|
+ }
|
|
|
+
|
|
|
boolean hasHardwareKeyboard() {
|
|
|
return !mHardwareKeyboardIds.isEmpty();
|
|
|
}
|
|
@@ -157,10 +162,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
|
|
@@ -178,14 +179,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();
|
|
@@ -206,6 +207,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;
|
|
|
}
|
|
|
|