Skip to content

Commit 11fc272

Browse files
committed
Use the keyboard_height already calculated in SDLSurfaceView
1 parent d891e14 commit 11fc272

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

recipes/android/src/android/_android.pyx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,18 +179,14 @@ version_codes = autoclass('android.os.Build$VERSION_CODES')
179179

180180

181181
python_act = autoclass('org.renpy.android.PythonActivity')
182-
Rect = autoclass('android.graphics.Rect')
183182
mActivity = python_act.mActivity
184183
if mActivity:
185-
# do not add a listener here, one is already implemented in the Hardware.java
186-
# that sends a event to kivy which makes a call to `get_keyboard_height`.
187-
decorview = mActivity.getWindow().getDecorView()
188-
default_display = mActivity.getWindowManager().getDefaultDisplay()
184+
# do not add a listener here, one is already implemented in
185+
# SDLSurfaceView.java which sends a event to kivy which makes
186+
# a call to `get_keyboard_height`.
189187

190188
def get_keyboard_height():
191-
rctx = Rect()
192-
decorview.getWindowVisibleDisplayFrame(rctx)
193-
return default_display.getHeight() - (rctx.bottom - rctx.top)
189+
return python_act.mView.kHeight
194190
else:
195191
def get_keyboard_height():
196192
return 0

0 commit comments

Comments
 (0)