mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-15 15:48:26 -04:00
Fix[kbd]: all keys released when switching language
This commit is contained in:
parent
540d8b5940
commit
a43de355b2
@ -469,8 +469,7 @@ public class MinecraftGLSurface extends View implements GrabListener {
|
|||||||
|
|
||||||
/** The event for keyboard/ gamepad button inputs */
|
/** The event for keyboard/ gamepad button inputs */
|
||||||
public boolean processKeyEvent(KeyEvent event) {
|
public boolean processKeyEvent(KeyEvent event) {
|
||||||
//Toast.makeText(this, event.toString(),Toast.LENGTH_SHORT).show();
|
//Log.i("KeyEvent", event.toString());
|
||||||
//Toast.makeText(this, event.getDevice().toString(), Toast.LENGTH_SHORT).show();
|
|
||||||
|
|
||||||
//Filtering useless events by order of probability
|
//Filtering useless events by order of probability
|
||||||
int eventKeycode = event.getKeyCode();
|
int eventKeycode = event.getKeyCode();
|
||||||
@ -478,7 +477,12 @@ public class MinecraftGLSurface extends View implements GrabListener {
|
|||||||
if(eventKeycode == KeyEvent.KEYCODE_VOLUME_DOWN) return false;
|
if(eventKeycode == KeyEvent.KEYCODE_VOLUME_DOWN) return false;
|
||||||
if(eventKeycode == KeyEvent.KEYCODE_VOLUME_UP) return false;
|
if(eventKeycode == KeyEvent.KEYCODE_VOLUME_UP) return false;
|
||||||
if(event.getRepeatCount() != 0) return true;
|
if(event.getRepeatCount() != 0) return true;
|
||||||
if(event.getAction() == KeyEvent.ACTION_MULTIPLE) return true;
|
int action = event.getAction();
|
||||||
|
if(action == KeyEvent.ACTION_MULTIPLE) return true;
|
||||||
|
// Ignore the cancelled up events. They occur when the user switches layouts.
|
||||||
|
// In accordance with https://developer.android.com/reference/android/view/KeyEvent#FLAG_CANCELED
|
||||||
|
if(action == KeyEvent.ACTION_UP &&
|
||||||
|
(event.getFlags() & KeyEvent.FLAG_CANCELED) != 0) return true;
|
||||||
|
|
||||||
//Sometimes, key events comes from SOME keys of the software keyboard
|
//Sometimes, key events comes from SOME keys of the software keyboard
|
||||||
//Even weirder, is is unknown why a key or another is selected to trigger a keyEvent
|
//Even weirder, is is unknown why a key or another is selected to trigger a keyEvent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user