From 4e39e6c56058d2ad326ff6be09d9f9d63cf82a73 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Thu, 7 May 2020 10:36:20 +0700 Subject: [PATCH] fix(oem): Back button to dismiss FV Android system keyboard Bring in the changes from #2950 and #3093 to the FV Android app --- oem/firstvoices/android/.gitignore | 1 + .../com/firstvoices/keyboards/SystemKeyboard.java | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/oem/firstvoices/android/.gitignore b/oem/firstvoices/android/.gitignore index 0722107965..8b8ddd2704 100644 --- a/oem/firstvoices/android/.gitignore +++ b/oem/firstvoices/android/.gitignore @@ -21,6 +21,7 @@ # Files generated as part of the build app/src/main/assets/packages app/src/main/assets/keyboards.csv +app/src/main/assets/fv_all.kmp # Legacy Eclipse IDE files .classpath diff --git a/oem/firstvoices/android/app/src/main/java/com/firstvoices/keyboards/SystemKeyboard.java b/oem/firstvoices/android/app/src/main/java/com/firstvoices/keyboards/SystemKeyboard.java index 49f1bd893b..28b99e153b 100644 --- a/oem/firstvoices/android/app/src/main/java/com/firstvoices/keyboards/SystemKeyboard.java +++ b/oem/firstvoices/android/app/src/main/java/com/firstvoices/keyboards/SystemKeyboard.java @@ -185,6 +185,18 @@ public class SystemKeyboard extends InputMethodService implements KeyboardEventH @Override public boolean onKeyDown(int keyCode, KeyEvent event) { + if (event.getAction() == KeyEvent.ACTION_DOWN) { + switch (keyCode) { + case KeyEvent.KEYCODE_BACK: + // Dismiss the keyboard if currently shown + if (isInputViewShown()) { + KMManager.hideSystemKeyboard(); + return true; + } + break; + } + } + return interpreter.onKeyDown(keyCode, event); // if false, will revert to default handling. }