mirror of
https://github.com/godotengine/godot.git
synced 2025-11-02 14:41:07 +00:00
Allow to obtain virtual keyboard height
On mobile platforms virtual keyboards take up significant amount of screen space and UI containing a text box may need to be adjusted after the keyboard appears to keep the text box visible to user. This commit adds a way to obtain virtual keyabord height so that controls are aware of how much they need to move.
This commit is contained in:
parent
6dc1025e63
commit
275e537058
14 changed files with 114 additions and 3 deletions
|
|
@ -754,6 +754,18 @@ static void _alert(const String &p_message, const String &p_title) {
|
|||
env->CallVoidMethod(_godot_instance, _alertDialog, jStrMessage, jStrTitle);
|
||||
}
|
||||
|
||||
// volatile because it can be changed from non-main thread and we need to
|
||||
// ensure the change is immediately visible to other threads.
|
||||
static volatile int virtual_keyboard_height;
|
||||
|
||||
static int _get_vk_height() {
|
||||
return virtual_keyboard_height;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setVirtualKeyboardHeight(JNIEnv *env, jobject obj, jint p_height) {
|
||||
virtual_keyboard_height = p_height;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *env, jobject obj, jobject activity, jboolean p_need_reload_hook, jobject p_asset_manager, jboolean p_use_apk_expansion) {
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "**INIT EVENT! - %p\n", env);
|
||||
|
|
@ -824,7 +836,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
|
|||
AudioDriverAndroid::setup(gob);
|
||||
}
|
||||
|
||||
os_android = new OS_Android(_gfx_init_func, env, _open_uri, _get_data_dir, _get_locale, _get_model, _get_screen_dpi, _show_vk, _hide_vk, _set_screen_orient, _get_unique_id, _get_system_dir, _play_video, _is_video_playing, _pause_video, _stop_video, _set_keep_screen_on, _alert, p_use_apk_expansion);
|
||||
os_android = new OS_Android(_gfx_init_func, env, _open_uri, _get_data_dir, _get_locale, _get_model, _get_screen_dpi, _show_vk, _hide_vk, _get_vk_height, _set_screen_orient, _get_unique_id, _get_system_dir, _play_video, _is_video_playing, _pause_video, _stop_video, _set_keep_screen_on, _alert, p_use_apk_expansion);
|
||||
os_android->set_need_reload_hooks(p_need_reload_hook);
|
||||
|
||||
char wd[500];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue