Repository navigation
fix(android): generate adaptive icon layers at adaptive-icon sizes - #653
Closed
shivapoudel wants to merge 1 commit into
Closed
shivapoudel wants to merge 1 commit into
shivapoudel wants to merge 1 commit into
Conversation
generateAdaptiveIconForeground and generateAdaptiveIconBackground filter AndroidAssetTemplates on AssetKind.Icon, so they emit the legacy launcher sizes (36/48/72/96/144/192) instead of the adaptive-icon sizes (81/108/162/216/324/432) — every layer comes out 0.444x too small. Both generator passes write the same mipmap-*/ic_launcher_foreground.png and ic_launcher_background.png paths, and the undersized pass runs last, so its output wins. Android then upscales the layers 2.25x to fill the 108dp adaptive layer and the launcher icon renders visibly blurry. The `as AndroidOutputAssetTemplateAdaptiveIcon[]` cast on the same expression suppressed the type error that would otherwise have caught this. generateLegacyIcon keeps AssetKind.Icon, which is correct for the pre-API-26 ic_launcher assets. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Author
|
Moving this to the Capawesome fork instead: capawesome-team#4. Closing here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
generateAdaptiveIconForeground()andgenerateAdaptiveIconBackground()filterAndroidAssetTemplatesonAssetKind.Icon:That yields the legacy launcher sizes rather than the adaptive-icon sizes:
Icon)AdaptiveIcon)Every adaptive layer is written
0.444x(48/108) too small.It goes unnoticed because two passes write the same paths. When
icon-foreground.png/icon-background.pngare supplied as standalone sources,generateFromLogo()first emits correctadaptive-icon-sized layers, then these two handlers overwrite them at legacy sizes:Android then upscales the layers 2.25x to fill the 108dp adaptive layer, so the launcher icon renders visibly blurry on device.
The
as AndroidOutputAssetTemplateAdaptiveIcon[]cast on the same expression suppressed the type error that would otherwise have flagged this.Fix
Filter on
AssetKind.AdaptiveIconin both handlers.generateLegacyIcon()keepsAssetKind.Icon, which is correct for the pre-API-26ic_launcherassets.Output paths and filenames are unchanged — the two template sets share the same
densitykeys and differ only inwidth/height.Reproducing
Place
icon-foreground.pngandicon-background.png(1024x1024) inassets/, runcapacitor-assets generate --android, then check the layer dimensions:Verification
npm run build— passesnpm test— 7 suites, 17 passed / 1 skippednpm run lint— passes (the 12no-non-null-assertionwarnings are pre-existing insrc/platforms/ios/index.ts)ic_launcherstill 36-192px,mipmap-anydpi-v26/*.xmlunchanged,:app:assembleDebugpasses, blur gone.