mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-14 04:39:23 +00:00
fix(android): Back button to dismiss system keyboard
Cherry-pick #2950 and #3093 to stable-13.0 This allows the back button to dismiss the system keyboard if shown. Additional back-presses revert to default UI behavior. As a throw-in, I made the same change to KMSample2
This commit is contained in:
parent
841afb9f53
commit
91c2e4a5a3
3 changed files with 28 additions and 0 deletions
|
|
@ -209,6 +209,18 @@ public class SystemKeyboard extends InputMethodService implements OnKeyboardEven
|
|||
|
||||
@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.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -184,6 +184,18 @@ public class SystemKeyboard extends InputMethodService implements OnKeyboardEven
|
|||
|
||||
@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.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
# Keyman for Android Version History
|
||||
|
||||
## 2020-05-07 13.0.6210 stable
|
||||
* Bug fix:
|
||||
* Back button dismisses system keyboard ()
|
||||
|
||||
## 2020-04-20 13.0.6209 stable
|
||||
* Bug fix:
|
||||
* Fix crash involving system keyboard update notifications (#3007)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue