mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 10:35:11 -04:00
Android: Fix trying to backspace or insert numbers in numerical fields crashing the game on old android versions (Thanks 123DMWM)
This commit is contained in:
parent
63f248f793
commit
34e4bf3605
@ -447,9 +447,12 @@ public class MainActivity extends Activity implements SurfaceHolder.Callback2 {
|
||||
public boolean sendKeyEvent(KeyEvent ev) {
|
||||
if (ev.getAction() != KeyEvent.ACTION_DOWN) return super.sendKeyEvent(ev);
|
||||
int code = ev.getKeyCode();
|
||||
int start = Selection.getSelectionStart(kbText);
|
||||
int uni = ev.getUnicodeChar();
|
||||
|
||||
// start is -1 sometimes, and trying to insert/delete there crashes
|
||||
int start = Selection.getSelectionStart(kbText);
|
||||
if (start == -1) start = kbText.toString().length();
|
||||
|
||||
if (code == KeyEvent.KEYCODE_ENTER) {
|
||||
// enter maps to \n but that should not be intercepted
|
||||
} else if (code == KeyEvent.KEYCODE_DEL) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user