Skip to content

Commit a4516a9

Browse files
committed
fix android package for services
1 parent 6c27ac9 commit a4516a9

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

recipes/android/src/android/_android.pyx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,16 @@ version_codes = autoclass('android.os.Build$VERSION_CODES')
181181
python_act = autoclass('org.renpy.android.PythonActivity')
182182
rctx = autoclass('android.graphics.Rect')()
183183
mActivity = python_act.mActivity
184-
decor_view = mActivity.getWindow().getDecorView()
185-
height = mActivity.getWindowManager().getDefaultDisplay().getHeight()
186-
# get keyboard height
187-
def get_keyboard_height():
188-
decor_view.getWindowVisibleDisplayFrame(rctx)
189-
return height - rctx.bottom
190-
184+
if mActivity:
185+
decor_view = mActivity.getWindow().getDecorView()
186+
height = mActivity.getWindowManager().getDefaultDisplay().getHeight()
187+
# get keyboard height
188+
def get_keyboard_height():
189+
decor_view.getWindowVisibleDisplayFrame(rctx)
190+
return height - rctx.bottom
191+
else:
192+
def get_keyboard_height():
193+
return 0
191194

192195
# Flags for input_type, for requesting a particular type of keyboard
193196
#android FLAGS

0 commit comments

Comments
 (0)