Skip to content

Commit

Permalink
Temporary hack to work around kivy/plyer#669
Browse files Browse the repository at this point in the history
It's convenient to put this Panda3D-specific hack in this repo for now, since we need to build custom Android wheels for pyjnius anyway
  • Loading branch information
rdb committed Oct 16, 2022
1 parent ee4e9c2 commit b49f977
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions jnius/reflect.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,16 @@ def autoclass(clsname, include_protected=True, include_private=True):
if cls:
return cls

if clsname.endswith('$mipmap') or clsname.endswith('$drawable'):
# Hack to work around kivy/plyer#669
PythonActivity = autoclass('org.panda3d.android.PythonActivity')
act = PythonActivity.mActivity
pkgname = act.getPackageName()
if clsname.startswith(pkgname + '.R$'):
pm = act.getPackageManager()
info = pm.getApplicationInfo(pkgname, 0)
return type('R', (object,), {'icon': info.icon})

classDict = {}
cls_start_packagename = '.'.join(clsname.split('.')[:-1])

Expand Down

0 comments on commit b49f977

Please sign in to comment.