Skip to content

Commit 52e1861

Browse files
committed
Trigger keyboard_height listener only when height is > 100.
1 parent 43f7f55 commit 52e1861

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/src/org/renpy/android/SDLSurfaceView.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
import java.nio.ByteBuffer;
6464
import java.nio.ByteOrder;
6565
import android.graphics.Color;
66+
import android.graphics.Rect;
6667
import android.content.res.Resources;
6768

6869

@@ -1171,11 +1172,18 @@ public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
11711172
// add a listener for the layout chnages to the IME view
11721173
final android.view.View activityRootView = mActivity.getWindow().getDecorView();
11731174
activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(new android.view.ViewTreeObserver.OnGlobalLayoutListener() {
1175+
final android.view.Display default_display = mActivity.getWindowManager().getDefaultDisplay();
1176+
11741177
@Override
11751178
public void onGlobalLayout() {
1176-
//send control sequence start /x04 == kayboard layout changed
1177-
nativeKey(45, 1, 4);
1178-
nativeKey(45, 0, 4);
1179+
Rect rctx = new Rect();
1180+
activityRootView.getWindowVisibleDisplayFrame(rctx);
1181+
int heightDiff = default_display.getHeight() - (rctx.bottom - rctx.top);
1182+
if (heightDiff > 100){
1183+
//send control sequence start /x04 == kayboard layout changed
1184+
nativeKey(45, 1, 4);
1185+
nativeKey(45, 0, 4);
1186+
}
11791187
}
11801188
});
11811189
return new BaseInputConnection(this, false){

0 commit comments

Comments
 (0)