Renamed a function

This commit is contained in:
pelya
2012-08-12 18:01:16 +03:00
parent e46400f500
commit 4ccba0347a
6 changed files with 23 additions and 24 deletions

View File

@@ -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)

View File

@@ -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();

View File

@@ -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);

View File

@@ -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
}

View File

@@ -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();
}

View File

@@ -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;
};