mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-28 03:26:15 +08:00
Fixed keyboard being hidden while being shown on Android
This commit is contained in:
@@ -45,6 +45,9 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
|||||||
// Is SurfaceView ready for rendering
|
// Is SurfaceView ready for rendering
|
||||||
protected boolean mIsSurfaceReady;
|
protected boolean mIsSurfaceReady;
|
||||||
|
|
||||||
|
// Is on-screen keyboard visible
|
||||||
|
protected boolean mKeyboardVisible;
|
||||||
|
|
||||||
// Pinch events
|
// Pinch events
|
||||||
private final ScaleGestureDetector scaleGestureDetector;
|
private final ScaleGestureDetector scaleGestureDetector;
|
||||||
|
|
||||||
@@ -210,11 +213,17 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
|||||||
SDLActivity.onNativeInsetsChanged(combined.left, combined.right, combined.top, combined.bottom);
|
SDLActivity.onNativeInsetsChanged(combined.left, combined.right, combined.top, combined.bottom);
|
||||||
|
|
||||||
if (insets.isVisible(WindowInsets.Type.ime())) {
|
if (insets.isVisible(WindowInsets.Type.ime())) {
|
||||||
|
if (!mKeyboardVisible) {
|
||||||
|
mKeyboardVisible = true;
|
||||||
SDLActivity.onNativeScreenKeyboardShown();
|
SDLActivity.onNativeScreenKeyboardShown();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (mKeyboardVisible) {
|
||||||
|
mKeyboardVisible = false;
|
||||||
SDLActivity.onNativeScreenKeyboardHidden();
|
SDLActivity.onNativeScreenKeyboardHidden();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Pass these to any child views in case they need them
|
// Pass these to any child views in case they need them
|
||||||
return insets;
|
return insets;
|
||||||
|
|||||||
Reference in New Issue
Block a user