mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Fix Return key events in LineEdit & TextEdit on Android
Depending on the device implementation, editor actions could be received with different action ids or not at all for multi-line. Added a parameter to virtual keyboards to properly handle single-line and multi-line cases in all situations. Single-line: Input type set to text without multiline to make sure actions are sent. IME options are set to DONE action to force action id consistency. Multi-line: Input type set to text and multiline to make sure enter triggers new lines. Actions are disabled by the multiline flag, so '\n' characters are handled in text changed callbacks.
This commit is contained in:
parent
33d423e240
commit
8c05dadcff
16 changed files with 57 additions and 29 deletions
|
@ -53,7 +53,7 @@ GodotIOJavaWrapper::GodotIOJavaWrapper(JNIEnv *p_env, jobject p_godot_io_instanc
|
|||
_get_model = p_env->GetMethodID(cls, "getModel", "()Ljava/lang/String;");
|
||||
_get_screen_DPI = p_env->GetMethodID(cls, "getScreenDPI", "()I");
|
||||
_get_unique_id = p_env->GetMethodID(cls, "getUniqueID", "()Ljava/lang/String;");
|
||||
_show_keyboard = p_env->GetMethodID(cls, "showKeyboard", "(Ljava/lang/String;III)V");
|
||||
_show_keyboard = p_env->GetMethodID(cls, "showKeyboard", "(Ljava/lang/String;ZIII)V");
|
||||
_hide_keyboard = p_env->GetMethodID(cls, "hideKeyboard", "()V");
|
||||
_set_screen_orientation = p_env->GetMethodID(cls, "setScreenOrientation", "(I)V");
|
||||
_get_screen_orientation = p_env->GetMethodID(cls, "getScreenOrientation", "()I");
|
||||
|
@ -132,11 +132,11 @@ bool GodotIOJavaWrapper::has_vk() {
|
|||
return (_show_keyboard != 0) && (_hide_keyboard != 0);
|
||||
}
|
||||
|
||||
void GodotIOJavaWrapper::show_vk(const String &p_existing, int p_max_input_length, int p_cursor_start, int p_cursor_end) {
|
||||
void GodotIOJavaWrapper::show_vk(const String &p_existing, bool p_multiline, int p_max_input_length, int p_cursor_start, int p_cursor_end) {
|
||||
if (_show_keyboard) {
|
||||
JNIEnv *env = ThreadAndroid::get_env();
|
||||
jstring jStr = env->NewStringUTF(p_existing.utf8().get_data());
|
||||
env->CallVoidMethod(godot_io_instance, _show_keyboard, jStr, p_max_input_length, p_cursor_start, p_cursor_end);
|
||||
env->CallVoidMethod(godot_io_instance, _show_keyboard, jStr, p_multiline, p_max_input_length, p_cursor_start, p_cursor_end);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue