-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Android: Refactor icon logic and make monochrome icon optional #99378
Android: Refactor icon logic and make monochrome icon optional #99378
Conversation
b6b13ec
to
97b1c4d
Compare
97b1c4d
to
69a1eac
Compare
This reverts commit a84292e.
69a1eac
to
c8aca35
Compare
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.
@syntaxerror247 Unfortunately the approach will not work either for the gradle build or for the legacy build.
In both scenarios, you have to keep in mind that the adaptive icon is only used for api 26 and above; for apis lower than 26 (our min is 21), the apk uses the png
mipmap resources and with your proposed fix, the manifest declaration will no longer match those png resources.
Here's how I think we can resolve this issue..
For the gradle build, you'll need to update icon.xml
to add / remove the monochrome
tag based on whether the user specified a monochrome icon or not.
For the legacy build, themed_icon.xml
will need to be in the apk as well, while the default remains icon.xml
(which does not contain a monochrome
tag):
- If a monochrome icon is not specified, nothing to do
- If a monochrome icon is specified, then
themed_icon.xml
data should be retrieved from the apk, and used to overwriteicon.xml
data similarly to how we overwrite thepng
resource data ingodot/platform/android/export/export_plugin.cpp
Line 3484 in 893bbdf
if (file.ends_with(".png") && file.contains("mipmap")) {
Sorry I don't understand it, isn't our current implementation similar. I will admit I haven't tested with api 26 and older devices but I don't anticipate any issues.
This approach aligns with what I was previously doing before resorting to directly modifying the file in the Manifest. I’ll switch to using this method instead.
This is a great idea, I can just overwrite it :D. I will update the PR to use this method. |
In this version of the PR, the presence of a monochrome icon changes the |
Now I understand, it would be an issue if a user enables monochrome and then uses the app on an older device and due to absence of icon App will falback to default Android icon. Thanks for clarifying! |
c8aca35
to
29f9e4d
Compare
94c107d
to
5c7ad28
Compare
Completely revamped the PR to address feedback and resolve issues with API 26 below devices. Also included a showcase video in the PR description. |
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.
Looks great! I've added some comments to polish the PR, then it should be good to go!
Btw, can you take a look at #98622 and check that it would not interfere with this fix.
185be86
to
18885d0
Compare
0d30f3b
to
59d970c
Compare
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.
Looks great!
Added a couple nitpick comments.
59d970c
to
f767cf0
Compare
Thanks! |
Continuation of #97517
Monochrome icons are optional in Android, but our current implementation requires them to be included. This PR addresses that issue by disabling the monochrome icon if it is not provided in the export settings, giving developers greater flexibility and control.
Showcase video
First, I installed apk without providing monochrome icon. Second apk is with monochrome icon.
showcase_video.mp4