-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add resources #2684
Add resources #2684
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to find a definitive solution, as it's clearly something that is missing and a lot of users are also complaining about it (also some plyer
PR could take advantage of resources).
Unfortunately, after some tests, I found out that this PR may need some fixes before getting merged.
--add-resource=mipmap:drawable-xhdpi
:drawable-xhdpi
already exists into the template, soshutil.copytree
fails.--add-resource=mipmap:drawable-hdpi-v4
:drawable-hdpi-v4
doesn't exists into the template, but if multiple builds are done with--add-resource=mipmap:drawable-hdpi-v4
, also hereshutil.copytree
will fail--add-resource=test.jpg:drawable/test.jpg
: It works, but if on a subsequent build I remove the resource (or I change the destination), the previous one does not get removed.
For 1 & 2: Luckily the solution is quite easy 😃
3: A JSON file that stores the status + a logic that does the sweeping could be the right choice?
PS: We could implement (3) later, but we will need to open an issue to track it.
1,2 ) These two have syntax errors, because of two What should these cases be?
The issue is that the Since the bootstrap is completely separate, a resolution to make
Is there a better way? (please be specific) Subsequent copytree() would have So user options override defaults, and specific options override general options. Which seems reasonable. (to me)
I propose changing the semantics of the zero
Implemented except TODO the buildozer.spec template to the comments above. |
Unless I'm missing something (that part of
Absolutely reasonable.
Nice! (I'm just not sure that Looks like we found the final solution for the resources drama, can you also take care of the |
@misl6 I think this is done, but I'm not 100% certain about our communication so let me know if I missed something. |
Hi @RobertFlatt , What about:
|
Hey @misl6 , I think I figured out the communication issue, my email client (Windows Mail) does not render On the subject of communication, your test copies from a directory named So back to actual behavior....
Unzips as (the local minmap directory contains the 2 pngs) :
The "-v4" is antiquated (some Gradle default?) https://developer.android.com/studio/write/image-asset-studio#notification but I assume it doesn't matter. FYI, the 'mipmap' xml resource also worked as a notification icon. The ModernDesign icons offer xml, it is the easy way to go. Subject to my question about mipmap in your test, I think good to go. |
Absolutely not. I just did not rename the source folder, as what I wanted to test here was something related to the copying mechanism, which is unrelated to the source folder name. For clarity: If I copy a full folder to an existing one (E.g. |
I think that was addressed 20ccb7c As shown #2684 (comment) by
Unzips as (the local minmap directory contains the 2 pngs) :
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you!
@misl6 Thanks. |
Why does adding Android resources have so many PRs but no implementation? Clearly users think it is a necessary feature. This is another try.
There are two outstanding PRs, #2580 and #2299. And a partial solution has previously been incorporated #2330, but is not documented in buildozer.spec and apparently doesn't work kivy/buildozer#1508.
This PR is based on the observation that there is a simple hack for adding resources using
add_assets
and prefixing the second field with../res/
like thisThis implementation simply copies the add_assets code fragments, and changes 'asset' to 'resourse'. The associated Buildozer PR is kivy/buildozer#1513
A test case is here https://github.com/RobertFlatt/add_resourse_test , this test sets a service icon (a custom service is created because setting the icon is not standard feature - but that is another issue). A drawable resource is declared using:
And the required resource ID is obtained with:
The test service is sticky, the app can be stopped but the service and its icon continue. So don't forget the stop the service at some point.