Synchronized the on-screen keyboard state with whether we are accepting text input.

The functions to show/hide/toggle the on-screen keyboard have been folded into the text input state.
Calling SDL_StartTextInput() will automatically show the on-screen keyboard if it's available.
Calling SDL_StopTextInput() will automatically hide the on-screen keyboard if it's available.
There is a new API function SDL_IsTextInputActive() which will return whether text input is currently active.
Text input is disabled by default, you must call SDL_StartTextInput() when you are ready to accept text input.
SDL_HasScreenKeyboardSupport() no longer needs to be passed a window.
The iPhone-specific on-screen keyboard functions have been removed.
This commit is contained in:
Sam Lantinga 2012-11-04 21:53:28 -08:00
parent 2228e50b28
commit e7b4458d8b
18 changed files with 97 additions and 219 deletions

View file

@ -119,7 +119,7 @@ public class SDLActivity extends Activity {
// Messages from the SDLMain thread
static final int COMMAND_CHANGE_TITLE = 1;
static final int COMMAND_KEYBOARD_SHOW = 2;
static final int COMMAND_UNUSED = 2;
static final int COMMAND_TEXTEDIT_HIDE = 3;
// Handler for the messages
@ -130,22 +130,6 @@ public class SDLActivity extends Activity {
case COMMAND_CHANGE_TITLE:
setTitle((String)msg.obj);
break;
case COMMAND_KEYBOARD_SHOW:
InputMethodManager manager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
if (manager != null) {
switch (((Integer)msg.obj).intValue()) {
case 0:
manager.hideSoftInputFromWindow(mSurface.getWindowToken(), 0);
break;
case 1:
manager.showSoftInput(mSurface, 0);
break;
case 2:
manager.toggleSoftInputFromWindow(mSurface.getWindowToken(), 0, 0);
break;
}
}
break;
case COMMAND_TEXTEDIT_HIDE:
if (mTextEdit != null) {
mTextEdit.setVisibility(View.GONE);