mirror of
https://github.com/encounter/SDL.git
synced 2025-12-08 13:15:10 +00:00
Fixed hiding the Android virtual keyboard when the return key is pressed
This commit is contained in:
@@ -762,6 +762,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
public static native void onNativeResize();
|
||||
public static native void onNativeKeyDown(int keycode);
|
||||
public static native void onNativeKeyUp(int keycode);
|
||||
public static native boolean onNativeSoftReturnKey();
|
||||
public static native void onNativeKeyboardFocusLost();
|
||||
public static native void onNativeMouse(int button, int action, float x, float y, boolean relative);
|
||||
public static native void onNativeTouch(int touchDevId, int pointerFingerId,
|
||||
@@ -2087,14 +2088,8 @@ class SDLInputConnection extends BaseInputConnection {
|
||||
*/
|
||||
|
||||
if (event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
|
||||
String imeHide = SDLActivity.nativeGetHint("SDL_RETURN_KEY_HIDES_IME");
|
||||
if ((imeHide != null) && imeHide.equals("1")) {
|
||||
Context c = SDL.getContext();
|
||||
if (c instanceof SDLActivity) {
|
||||
SDLActivity activity = (SDLActivity)c;
|
||||
activity.sendCommand(SDLActivity.COMMAND_TEXTEDIT_HIDE, null);
|
||||
return true;
|
||||
}
|
||||
if (SDLActivity.onNativeSoftReturnKey()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2107,6 +2102,11 @@ class SDLInputConnection extends BaseInputConnection {
|
||||
|
||||
for (int i = 0; i < text.length(); i++) {
|
||||
char c = text.charAt(i);
|
||||
if (c == '\n') {
|
||||
if (SDLActivity.onNativeSoftReturnKey()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
nativeGenerateScancodeForUnichar(c);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user