diff --git a/ReadMe.txt b/ReadMe.txt index f4dfad4..2e8b60f 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -54,9 +54,9 @@ NOT WORKING YET CHANGES -Version 1.8beta1 (2019-12-18) +Version 1.8beta2 (2019-12-19) -- Try to better detect a physical keyboard to modify the mapping of the keys. +- Intercept the ESC keyboard key to allow the use of the BACK soft key. Version 1.7 (2019-12-12) diff --git a/app/build.gradle b/app/build.gradle index b4b215b..c271469 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -33,8 +33,8 @@ android { applicationId "org.emulator.forty.eight" minSdkVersion 19 targetSdkVersion 28 - versionCode 12 - versionName "1.8beta1" + versionCode 13 + versionName "1.8beta2" setProperty("archivesBaseName", "Emu48-v$versionName") testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" externalNativeBuild { diff --git a/app/src/main/assets/ReadMe.txt b/app/src/main/assets/ReadMe.txt index f3168fd..b77b9e4 100644 --- a/app/src/main/assets/ReadMe.txt +++ b/app/src/main/assets/ReadMe.txt @@ -54,9 +54,9 @@ NOT WORKING YET CHANGES -Version 1.8beta1 (2019-12-18) +Version 1.8beta2 (2019-12-19) -- Try to better detect a physical keyboard to modify the mapping of the keys. +- Intercept the ESC keyboard key to allow the use of the BACK soft key. Version 1.7 (2019-12-12) diff --git a/app/src/main/java/org/emulator/calculator/MainScreenView.java b/app/src/main/java/org/emulator/calculator/MainScreenView.java index 13255de..ed0ab53 100644 --- a/app/src/main/java/org/emulator/calculator/MainScreenView.java +++ b/app/src/main/java/org/emulator/calculator/MainScreenView.java @@ -203,8 +203,7 @@ public class MainScreenView extends PanAndScaleView { @Override public boolean onKeyDown(int keyCode, KeyEvent event) { - if(event.getDeviceId() != -1 - && (event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY) == 0 + if((event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY) == 0 && (event.getSource() & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD) { char pressedKey = (char) event.getUnicodeChar(); Integer windowsKeycode = charmap.get(pressedKey); @@ -215,7 +214,7 @@ public class MainScreenView extends PanAndScaleView { if (windowsKeycode != 0) NativeLib.keyDown(windowsKeycode); else if(debug) Log.e(TAG, String.format("Unknown keyCode: %d", keyCode)); - if(keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_TAB) + if(keyCode == KeyEvent.KEYCODE_ESCAPE /*KEYCODE_BACK*/ || keyCode == KeyEvent.KEYCODE_TAB) return true; } return super.onKeyDown(keyCode, event); @@ -223,8 +222,7 @@ public class MainScreenView extends PanAndScaleView { @Override public boolean onKeyUp(int keyCode, KeyEvent event) { - if(event.getDeviceId() != -1 - && (event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY) == 0 + if((event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY) == 0 && (event.getSource() & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD) { char pressedKey = (char) event.getUnicodeChar(); Integer windowsKeycode = charmap.get(pressedKey); @@ -235,7 +233,7 @@ public class MainScreenView extends PanAndScaleView { if (windowsKeycode != 0) NativeLib.keyUp(windowsKeycode); else if(debug) Log.e(TAG, String.format("Unknown keyCode: %d", keyCode)); - if(keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_TAB) + if(keyCode == KeyEvent.KEYCODE_ESCAPE /*KEYCODE_BACK*/ || keyCode == KeyEvent.KEYCODE_TAB) return true; } return super.onKeyUp(keyCode, event);