summaryrefslogtreecommitdiff
path: root/platform/android/java
diff options
context:
space:
mode:
authorPouleyKetchoupp <pouleyketchoup@gmail.com>2020-03-13 17:04:11 +0100
committerPouleyKetchoupp <pouleyketchoup@gmail.com>2020-03-13 17:04:40 +0100
commitc169367e83abcd606c509d520097265c2b323728 (patch)
tree3b19d0b949f90b9dd578afda3bac6ce0d302bef4 /platform/android/java
parent951ecc4f79a760160bdc7adc3b0b40e9e4c6b82d (diff)
Fix text_entered signal when max_length is used in LineEdit on Android
Fixes #35954
Diffstat (limited to 'platform/android/java')
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/input/GodotTextInputWrapper.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/GodotTextInputWrapper.java b/platform/android/java/lib/src/org/godotengine/godot/input/GodotTextInputWrapper.java
index 8d9b5461a1..18f2d57661 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/input/GodotTextInputWrapper.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/input/GodotTextInputWrapper.java
@@ -110,8 +110,13 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
@Override
public void run() {
for (int i = 0; i < count; ++i) {
- GodotLib.key(0, 0, newChars[i], true);
- GodotLib.key(0, 0, newChars[i], false);
+ int key = newChars[i];
+ if (key == '\n') {
+ // Return keys are handled through action events
+ continue;
+ }
+ GodotLib.key(0, 0, key, true);
+ GodotLib.key(0, 0, key, false);
}
}
});
@@ -134,8 +139,13 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
});
}
- if (pActionID == EditorInfo.IME_ACTION_DONE) {
+ if (pActionID == EditorInfo.IME_NULL) {
+ // Enter key has been pressed
+ GodotLib.key(KeyEvent.KEYCODE_ENTER, KeyEvent.KEYCODE_ENTER, 0, true);
+ GodotLib.key(KeyEvent.KEYCODE_ENTER, KeyEvent.KEYCODE_ENTER, 0, false);
+
this.mView.requestFocus();
+ return true;
}
return false;
}