python-for-android
python-for-android copied to clipboard
Support Android resources similarly to assets
trafficstars
Fixes #2298
This PR allows adding a resource to the Android resources folder exactly as an asset. Difference with assets is that resources can subsequently be instantiated as Drawables:
Drawable = jnius.autoclass("{}.R$drawable".format(__pkg_name__)) # __pkg_name__ is tld.org.app
custom_icon = getattr(Drawable, "custom_icon")
This is especially useful to pick a notification icon that respect the new Android requirements (PNG with white shape on transparent background) instead of using the app icon, which gets rendered as a white square on many recent devices. I could not find an easy way to do so with an asset.
I think you forgot to expose this functionality in toolchain.py.
Superseded by https://github.com/kivy/python-for-android/pull/2684