Allow adding drawable to icon externally
See original GitHub issueI have a use case that does not allow me to add icons as specified in the custom icon packs wiki. The drawable I am trying to add to the icon pack has two paths and cannot possibly be added using the custom icons XML since the icon element can only allow one path attribute.
I am thinking of going through a route that adds such icons by manually creating Icon
instances and adding them to the IconPack
(hopefully that approach does not present a problem) but the icon
drawable
property is set as internal
. Is there a reason the drawable property has an internal modifier?
Thanks for the awesome lib.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (6 by maintainers)
Top Results From Across the Web
How to add an image to the "drawable" folder in Android Studio?
Right click on res -> new -> Image Asset; On Asset type choose Action Bar and Tab Icons; Choose the image path; Give...
Read more >Create app icons with Image Asset Studio - Android Developers
After you open Image Asset Studio, you can add adaptive and legacy icons by following these steps: In the Icon Type field, select...
Read more >How to Add Image to Drawable Folder in Android Studio?
Step 1: Open Android Studio and go to the app > res > right-click > New > Image Asset as shown in the...
Read more >Android: Notification Icons - OneSignal Documentation
Adding custom icons to some or all of your notifications. Works with Android (and ... You must add each image with listed size...
Read more >How to Add Custom Icons to Your Flutter Application
Let's assume we want this image to be our application launcher icon: 1_G3Ro06E4rc6F30BC9n-OBw. First, add the image you would like to use as ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The
IconPack.drawable
property is internal because I supposed only theIconDrawableLoader
would have load icons.Even if you were able to set them manually, I’m not sure if the icon dialog will support your icons, because they will get tinted. You would need to have only monochromatic opaque icons, which can always be represented with a single path anyway. (you can do path union with inkscape or similar tools if that’s your case)
I can make the property public and add an option to disable tinting if it’s problematic, but you’ll probably need another way of indicating selection. Also, depending on the number of icons you have, creating them programmatically may not be the most elegant solution.
Of course, it would also be possible to extend the library functionality to allow defining icons with multiple paths of different colors like this:
That wouldn’t be too hard to implement, but in my opinion it goes beyond the purpose of the library, so I won’t go there. You would have to make modifications to the icon pack parser and the drawable loader. If you’re interested, you can take a look at my answer on Stack Overflow which covers the subject of creating multi path vector drawables.
The user probably has the responsibility of ensuring the icon they are adding is tintable. It might be enough for the lib to just tint the icon drawable as already done here: https://github.com/idrisadetunmbi/icondialoglib/commit/6131bec0a89a717d52817de2fccb0355f5318ae6#diff-cf7ca223f86ef0063bdb90b1487e37a6R374