diff --git a/project/java/MainActivity.java b/project/java/MainActivity.java index f45deaf4e..0449e9767 100644 --- a/project/java/MainActivity.java +++ b/project/java/MainActivity.java @@ -318,20 +318,17 @@ public class MainActivity extends Activity { System.exit(0); } - public void togglePlainAndroidSoftKeyboardInput() + public void showScreenKeyboardWithoutTextInputField() { - InputMethodManager imm = (InputMethodManager) getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE); - imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); + _inputManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); + _inputManager.showSoftInput(mGLView, InputMethodManager.SHOW_FORCED); } public void showScreenKeyboard(final String oldText, boolean sendBackspace) { if(Globals.CompatibilityHacksTextInputEmulatesHwKeyboard) { - _inputManager.showSoftInput(mGLView, InputMethodManager.SHOW_FORCED); - mGLView.setFocusable(true); - mGLView.setFocusableInTouchMode(true); - mGLView.requestFocus(); + showScreenKeyboardWithoutTextInputField(); return; } if(_screenKeyboard != null) diff --git a/project/java/Video.java b/project/java/Video.java index c47ca947d..28dee7bff 100644 --- a/project/java/Video.java +++ b/project/java/Video.java @@ -524,14 +524,14 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer return 1; } - public void togglePlainAndroidSoftKeyboardInput() // Called from native code + public void showScreenKeyboardWithoutTextInputField() // Called from native code { class Callback implements Runnable { public MainActivity parent; public void run() { - parent.togglePlainAndroidSoftKeyboardInput(); + parent.showScreenKeyboardWithoutTextInputField(); } } Callback cb = new Callback(); diff --git a/project/jni/application/opentyrian/src/mainint.cpp b/project/jni/application/opentyrian/src/mainint.cpp index cdc949faa..f2915805f 100644 --- a/project/jni/application/opentyrian/src/mainint.cpp +++ b/project/jni/application/opentyrian/src/mainint.cpp @@ -2404,7 +2404,7 @@ void JE_operation( JE_byte slot ) JE_barShade(VGAScreen, 65, 55, 255, 155); #ifdef ANDROID - SDL_ANDROID_CallJavaTogglePlainAndroidSoftKeyboardInput(); + SDL_ANDROID_ToggleScreenKeyboardWithoutTextInput(); #endif bool quit = false; while (!quit) @@ -2518,7 +2518,7 @@ void JE_operation( JE_byte slot ) case SDLK_SPACE: quit = true; #ifdef ANDROID - SDL_ANDROID_CallJavaTogglePlainAndroidSoftKeyboardInput(); + SDL_ANDROID_ToggleScreenKeyboardWithoutTextInput(); #endif JE_saveGame(slot, stemp); JE_playSampleNum(S_SELECT); diff --git a/project/jni/sdl-1.2/include/SDL_screenkeyboard.h b/project/jni/sdl-1.2/include/SDL_screenkeyboard.h index 016a0abf9..4f972735b 100644 --- a/project/jni/sdl-1.2/include/SDL_screenkeyboard.h +++ b/project/jni/sdl-1.2/include/SDL_screenkeyboard.h @@ -86,27 +86,28 @@ extern DECLSPEC /* Buttons 0 and 1 may have auto-fire state */ extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardAutoFireButtonsAmount(int nbuttons); -extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardAutoFireButtonsAmount(); +extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardAutoFireButtonsAmount(void); extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardShown(int shown); -extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardShown(); +extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardShown(void); -extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardSize(); +extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardSize(void); /* Show Android on-screen keyboard, and pass entered text back to application as SDL keypress events, previousText is UTF-8 encoded, it may be NULL, only 256 first bytes will be used, and this call will not block */ extern DECLSPEC int SDLCALL SDL_ANDROID_ToggleScreenKeyboardTextInput(const char * previousText); +/* Show only the bare Android on-screen keyboard without any text input field, so it won't cover the screen */ +extern DECLSPEC int SDLCALL SDL_ANDROID_ToggleScreenKeyboardWithoutTextInput(void); + /* Show Android on-screen keyboard, and pass entered text back to application in a buffer, using buffer contents as previous text (UTF-8 encoded), the buffer may be of any size - this call will block until user typed all text. */ extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardTextInput(char * textBuf, int textBufSize); /* Whether user redefined on-screen keyboard layout via SDL menu, app should not enforce it's own layout in that case */ -extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardRedefinedByUser(); +extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardRedefinedByUser(void); -/* Show only the bare Android on-screen keyboard without any text input field */ -extern DECLSPEC void SDLCALL SDL_ANDROID_CallJavaTogglePlainAndroidSoftKeyboardInput(); #ifdef __cplusplus } diff --git a/project/jni/sdl-1.3/src/video/android/SDL_androidvideo.c b/project/jni/sdl-1.3/src/video/android/SDL_androidvideo.c index 0db87265d..a120f5349 100644 --- a/project/jni/sdl-1.3/src/video/android/SDL_androidvideo.c +++ b/project/jni/sdl-1.3/src/video/android/SDL_androidvideo.c @@ -61,7 +61,7 @@ static jclass JavaRendererClass = NULL; static jobject JavaRenderer = NULL; static jmethodID JavaSwapBuffers = NULL; static jmethodID JavaShowScreenKeyboard = NULL; -static jmethodID JavaTogglePlainAndroidSoftKeyboardInput = NULL; +static jmethodID JavaToggleScreenKeyboardWithoutTextInput = NULL; static int glContextLost = 0; static int showScreenKeyboardDeferred = 0; static const char * showScreenKeyboardOldText = ""; @@ -226,9 +226,10 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeGlContextRecreated) ( JNIEnv* env, jobject #endif } -void SDL_ANDROID_CallJavaTogglePlainAndroidSoftKeyboardInput() +int SDL_ANDROID_ToggleScreenKeyboardWithoutTextInput(void) { - (*JavaEnv)->CallVoidMethod( JavaEnv, JavaRenderer, JavaTogglePlainAndroidSoftKeyboardInput ); + (*JavaEnv)->CallVoidMethod( JavaEnv, JavaRenderer, JavaToggleScreenKeyboardWithoutTextInput ); + return 1; } volatile static textInputFinished = 0; @@ -289,7 +290,7 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeInitJavaCallbacks) ( JNIEnv* env, jobject t JavaRendererClass = (*JavaEnv)->GetObjectClass(JavaEnv, thiz); JavaSwapBuffers = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "swapBuffers", "()I"); JavaShowScreenKeyboard = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "showScreenKeyboard", "(Ljava/lang/String;I)V"); - JavaTogglePlainAndroidSoftKeyboardInput = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "togglePlainAndroidSoftKeyboardInput", "()V"); + JavaToggleScreenKeyboardWithoutTextInput = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "showScreenKeyboardWithoutTextInputField", "()V"); ANDROID_InitOSKeymap(); } diff --git a/project/jni/sdl-1.3/src/video/android/SDL_touchscreenkeyboard.c b/project/jni/sdl-1.3/src/video/android/SDL_touchscreenkeyboard.c index 53f4b1f73..aaf549c82 100644 --- a/project/jni/sdl-1.3/src/video/android/SDL_touchscreenkeyboard.c +++ b/project/jni/sdl-1.3/src/video/android/SDL_touchscreenkeyboard.c @@ -1004,7 +1004,7 @@ int SDL_ANDROID_SetScreenKeyboardAutoFireButtonsAmount(int nbuttons) return 1; }; -int SDL_ANDROID_GetScreenKeyboardAutoFireButtonsAmount() +int SDL_ANDROID_GetScreenKeyboardAutoFireButtonsAmount(void) { return AutoFireButtonsNum; }; @@ -1014,12 +1014,12 @@ int SDL_ANDROID_SetScreenKeyboardShown(int shown) touchscreenKeyboardShown = shown; }; -int SDL_ANDROID_GetScreenKeyboardShown() +int SDL_ANDROID_GetScreenKeyboardShown(void) { return touchscreenKeyboardShown; }; -int SDL_ANDROID_GetScreenKeyboardSize() +int SDL_ANDROID_GetScreenKeyboardSize(void) { return buttonsize; };