diff options
Diffstat (limited to 'platform/android/java/src/org/godotengine/godot/input')
| -rw-r--r-- | platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java b/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java index c2d03e4ec..04669a3b0 100644 --- a/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java +++ b/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java @@ -89,8 +89,13 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene //Log.d(TAG, "beforeTextChanged(" + pCharSequence + ")start: " + start + ",count: " + count + ",after: " + after); for (int i=0;i<count;i++){ - GodotLib.key(KeyEvent.KEYCODE_DEL, 0, true); - GodotLib.key(KeyEvent.KEYCODE_DEL, 0, false); + mView.queueEvent(new Runnable() { + @Override + public void run() { + GodotLib.key(KeyEvent.KEYCODE_DEL, 0, true); + GodotLib.key(KeyEvent.KEYCODE_DEL, 0, false); + } + }); } } @@ -99,9 +104,14 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene //Log.d(TAG, "onTextChanged(" + pCharSequence + ")start: " + start + ",count: " + count + ",before: " + before); for (int i=start;i<start+count;i++){ - int ch = pCharSequence.charAt(i); - GodotLib.key(0, ch, true); - GodotLib.key(0, ch, false); + final int ch = pCharSequence.charAt(i); + mView.queueEvent(new Runnable() { + @Override + public void run() { + GodotLib.key(0, ch, true); + GodotLib.key(0, ch, false); + } + }); } } @@ -111,8 +121,14 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene if (this.mEdit == pTextView && this.isFullScreenEdit()) { // user press the action button, delete all old text and insert new text for (int i = this.mOriginText.length(); i > 0; i--) { - GodotLib.key(KeyEvent.KEYCODE_DEL, 0, true); - GodotLib.key(KeyEvent.KEYCODE_DEL, 0, false); + mView.queueEvent(new Runnable() { + @Override + public void run() { + GodotLib.key(KeyEvent.KEYCODE_DEL, 0, true); + GodotLib.key(KeyEvent.KEYCODE_DEL, 0, false); + } + }); + /* if (BuildConfig.DEBUG) { Log.d(TAG, "deleteBackward"); @@ -131,9 +147,14 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene } for(int i = 0; i < text.length(); i++) { - int ch = text.codePointAt(i); - GodotLib.key(0, ch, true); - GodotLib.key(0, ch, false); + final int ch = text.codePointAt(i); + mView.queueEvent(new Runnable() { + @Override + public void run() { + GodotLib.key(0, ch, true); + GodotLib.key(0, ch, false); + } + }); } /* if (BuildConfig.DEBUG) { @@ -141,7 +162,7 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene } */ } - + if (pActionID == EditorInfo.IME_ACTION_DONE) { this.mView.requestFocus(); } |
