diff options
author | mvglasow <michael -at- vonglasow.com> | 2015-11-15 23:05:24 +0100 |
---|---|---|
committer | mvglasow <michael -at- vonglasow.com> | 2016-02-24 09:43:46 +0100 |
commit | 0c0697760bb9b78013812ee816a30c7af148520d (patch) | |
tree | a6f237d502db69ace0fe65611474c5f4a66db8e7 /navit/graphics | |
parent | 6e8450f7ce39f4c713bcbd8368e1b25d32f98283 (diff) | |
download | navit-0c0697760bb9b78013812ee816a30c7af148520d.tar.gz |
Fix:gui_internal:Further native keyboard refinements
Allow graphics plugin to specify size occupied by keyboard
Create placeholder for Android keyboard
Show Android keyboard in landscape mode
Skip keyboard logic if hardware keyboard is present on Android
Add some documentation and comments
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Diffstat (limited to 'navit/graphics')
-rw-r--r-- | navit/graphics/android/graphics_android.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/navit/graphics/android/graphics_android.c b/navit/graphics/android/graphics_android.c index c88ee11fd..41f441c96 100644 --- a/navit/graphics/android/graphics_android.c +++ b/navit/graphics/android/graphics_android.c @@ -1136,7 +1136,7 @@ event_android_new(struct event_methods *meth) Navit_showMenu = (*jnienv)->GetMethodID(jnienv, NavitClass, "showMenu", "()V"); if (Navit_showMenu == NULL) return NULL; - Navit_showNativeKeyboard = (*jnienv)->GetMethodID(jnienv, NavitClass, "showNativeKeyboard", "()Z"); + Navit_showNativeKeyboard = (*jnienv)->GetMethodID(jnienv, NavitClass, "showNativeKeyboard", "()I"); Navit_hideNativeKeyboard = (*jnienv)->GetMethodID(jnienv, NavitClass, "hideNativeKeyboard", "()V"); dbg(lvl_debug,"ok\n"); @@ -1152,18 +1152,28 @@ event_android_new(struct event_methods *meth) * displayed. A typical case in which there is no need for an on-screen input method is if a hardware * keyboard is present. * + * Note that the Android platform lacks reliable means of determining whether an on-screen input method + * is going to be displayed or how much screen space it is going to occupy. Therefore this method tries + * to guess these values. They have been tested and found to work correctly with the AOSP keyboard, and + * are thus expected to be compatible with most on-screen keyboards found on the market, but results may + * be unexpected with other input methods. + * * @param kbd A {@code struct graphics_keyboard} which describes the requirements for the input method * and will be populated with the data of the input method before the function returns. * - * @return True if the input method is displayed, false if not. + * @return True if the input method is going to be displayed, false if not. */ int show_native_keyboard (struct graphics_keyboard *kbd) { - // TODO populate kbd with values + kbd->w = -1; if (Navit_showNativeKeyboard == NULL) { dbg(lvl_error, "method Navit.showNativeKeyboard() not found, cannot display keyboard\n"); return 0; } - return (*jnienv)->CallBooleanMethod(jnienv, android_activity, Navit_showNativeKeyboard); + kbd->h = (*jnienv)->CallIntMethod(jnienv, android_activity, Navit_showNativeKeyboard); + dbg(lvl_error, "keyboard size is %d x %d px\n", kbd->w, kbd->h); + dbg(lvl_error, "return\n"); + /* zero height means we're not showing a keyboard, therefore normalize height to boolean */ + return !!(kbd->h); } |