Skip to content

move parts of get_keyboard_height to global #272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 23, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions recipes/android/src/android/_android.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,16 @@ def get_dpi():
cdef extern void android_show_keyboard(int)
cdef extern void android_hide_keyboard()


from jnius import autoclass
python_act = autoclass('org.renpy.android.PythonActivity')
rctx = autoclass('android.graphics.Rect')()
mActivity = python_act.mActivity
decor_view = mActivity.getWindow().getDecorView()
height = mActivity.getWindowManager().getDefaultDisplay().getHeight()
# get keyboard height
def get_keyboard_height():
from jnius import autoclass
python_act = autoclass('org.renpy.android.PythonActivity')
rctx = autoclass('android.graphics.Rect')()
mActivity = python_act.mActivity
mActivity.getWindow().getDecorView().\
getWindowVisibleDisplayFrame(rctx)
height = mActivity.getWindowManager().getDefaultDisplay().getHeight()
decor_view.getWindowVisibleDisplayFrame(rctx)
return height - rctx.bottom


Expand Down