python-for-android icon indicating copy to clipboard operation
python-for-android copied to clipboard

Support Android resources similarly to assets

Open lerela opened this issue 5 years ago • 1 comments
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.

lerela avatar Aug 14 '20 21:08 lerela

I think you forgot to expose this functionality in toolchain.py.

robertpfeiffer avatar Jan 15 '21 15:01 robertpfeiffer

Superseded by https://github.com/kivy/python-for-android/pull/2684

misl6 avatar Nov 05 '22 09:11 misl6