Provide the correct state of the on-screen keyboard to the API (patch from Sylvain)

This commit is contained in:
Sam Lantinga 2017-08-13 21:05:15 -07:00
parent 545c6ea1eb
commit fae0fc30b3
4 changed files with 60 additions and 1 deletions

View file

@ -1684,6 +1684,20 @@ void Android_JNI_HideTextInput(void)
Android_JNI_SendMessage(COMMAND_TEXTEDIT_HIDE, 0);
}
SDL_bool Android_JNI_IsScreenKeyboardShown()
{
jmethodID mid;
jboolean is_shown = 0;
JNIEnv *mEnv = Android_JNI_GetEnv();
mid = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,"isScreenKeyboardShown","()Z");
if (mid) {
is_shown = (*mEnv)->CallStaticBooleanMethod(mEnv, mActivityClass, mid);
}
return is_shown;
}
int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
{
JNIEnv *env;

View file

@ -38,6 +38,7 @@ extern void Android_JNI_SetOrientation(int w, int h, int resizable, const char *
extern SDL_bool Android_JNI_GetAccelerometerValues(float values[3]);
extern void Android_JNI_ShowTextInput(SDL_Rect *inputRect);
extern void Android_JNI_HideTextInput(void);
extern SDL_bool Android_JNI_IsScreenKeyboardShown(void);
extern ANativeWindow* Android_JNI_GetNativeWindow(void);
/* Audio support */