Do not consume keyboard arrow keys on Android (pass to both joystick and keyboard events) and handle dpad center as keyboard enter (like on Kindle FireTV)
This commit is contained in:
@@ -344,7 +344,7 @@ class MainView extends GLSurfaceView {
|
|||||||
|
|
||||||
final MainView me = this;
|
final MainView me = this;
|
||||||
|
|
||||||
::if (ANDROID_TARGET_SDK_VERSION > 11)::if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1 && (event.isGamepadButton (inKeyCode) || (inKeyCode >= 19 && inKeyCode <= 22))) {
|
::if (ANDROID_TARGET_SDK_VERSION > 11)::if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1 && (event.isGamepadButton (inKeyCode) || (inKeyCode >= 19 && inKeyCode <=22))) {
|
||||||
|
|
||||||
if (event.getRepeatCount () == 0) {
|
if (event.getRepeatCount () == 0) {
|
||||||
|
|
||||||
@@ -362,7 +362,11 @@ class MainView extends GLSurfaceView {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
if (inKeyCode < 19 || inKeyCode > 22) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}::end::
|
}::end::
|
||||||
|
|
||||||
@@ -394,7 +398,7 @@ class MainView extends GLSurfaceView {
|
|||||||
|
|
||||||
final MainView me = this;
|
final MainView me = this;
|
||||||
|
|
||||||
::if (ANDROID_TARGET_SDK_VERSION > 11)::if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1 && (event.isGamepadButton (inKeyCode) || (inKeyCode >= 19 && inKeyCode <= 22))) {
|
::if (ANDROID_TARGET_SDK_VERSION > 11)::if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1 && (event.isGamepadButton (inKeyCode) || (inKeyCode >= 19 && inKeyCode <=22))) {
|
||||||
|
|
||||||
if (event.getRepeatCount () == 0) {
|
if (event.getRepeatCount () == 0) {
|
||||||
|
|
||||||
@@ -412,7 +416,11 @@ class MainView extends GLSurfaceView {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
if (inKeyCode < 19 || inKeyCode > 22) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}::end::
|
}::end::
|
||||||
|
|
||||||
@@ -589,6 +597,7 @@ class MainView extends GLSurfaceView {
|
|||||||
|
|
||||||
switch (inCode) {
|
switch (inCode) {
|
||||||
|
|
||||||
|
case KeyEvent.KEYCODE_DPAD_CENTER: return 13; // Enter
|
||||||
case KeyEvent.KEYCODE_BACK: return 27; /* Fake Escape */
|
case KeyEvent.KEYCODE_BACK: return 27; /* Fake Escape */
|
||||||
case KeyEvent.KEYCODE_MENU: return 0x01000012; /* Fake MENU */
|
case KeyEvent.KEYCODE_MENU: return 0x01000012; /* Fake MENU */
|
||||||
case KeyEvent.KEYCODE_DEL: return 8;
|
case KeyEvent.KEYCODE_DEL: return 8;
|
||||||
|
|||||||
Reference in New Issue
Block a user