-
-
Notifications
You must be signed in to change notification settings - Fork 197
feat: Added support for generating android adaptive icons #5667
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
feat: Added support for generating android adaptive icons #5667
Conversation
this PR is quite useful, now the icon generation is broken and it is quite annoying to execute the command and not see the change in the application |
@NathanWalker I know there's been a discussion about a different approach but perhaps we could give this one a try until then. This PR is trying to follow the principles described in this guide: https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive These new dimensions equal to size of inner content of foreground layer which has to be 72dp. Multiplying those by 1.5 during asset generation gives us the right pixels for both layers size that equal to 108dp. An example of new android asset definitions: {
"width": 144,
"height": 144,
"directory": "drawable-xhdpi",
"filename": "ic_launcher_foreground.png",
"resizeOperation": "outerScale",
"scale": "1.5x"
} It's using the existing asset generation API with the addition of new |
e790e75
to
d1f7e4e
Compare
ns resources generate icons
command to work with latest app templates
@NathanWalker I have applied my final changes on this one. Few details regarding android icons. CLI did not generate icons unless it found old icons with identical names in file system. This is actually a feature that was introduced here: 075686c Regarding the output content, it generates simple icons whose rendering is similar to the one of the 'legacy icons' used in old app templates (icon.png). |
You can test and post feedback if you like using my branch: https://github.com/CatchABus/nativescript-cli/tree/android-generate-icons-fix |
Hi! I'm also running into this issue. Is there a plan to release these fixes? |
PR Checklist
What is the current behavior?
Command
ns resources generate icons <source image path>
cannot generate app launcher icons ever since the adaptive icons addition (ic_launcher). Right now, developers have no ways to generate android launcher icons apart from using Android Studio.What is the new behavior?
Command
ns resources generate icons <source image path>
will generate all needed icons.According to google, adaptive icons have few requirements:
In order to comply with these requirements, I updated
image-definitions.json
using the following concept:ic_launcher_foreground
resized to 72 dp converted to pixels.outerScale
was added to CLI. Using this operation, we can scale the outer part of the image (it's a bottom layer actually), which will become an opaque layer using hex#00000000
.Fixes/Implements/Closes #5571.