Skip to content

Add Material You themed launcher icon#142

Merged
malkoG merged 1 commit intohackers-pub:mainfrom
dalinaum:claude/monochrome-icon
Apr 20, 2026
Merged

Add Material You themed launcher icon#142
malkoG merged 1 commit intohackers-pub:mainfrom
dalinaum:claude/monochrome-icon

Conversation

@dalinaum
Copy link
Copy Markdown
Contributor

Summary

  • Wire up a <monochrome> layer on the adaptive launcher icon so the app participates in Android 13+ Themed icons with a branded silhouette instead of a solid tinted blob.
  • Ship the themed icon for both the main release variant (cat silhouette) and the .dev debug variant (cat + DEV badge).
  • Drop the redundant -v26 resource qualifier since minSdk = 26 makes it a no-op.

Before / after

With Themed icons enabled on Android 13+:

Before After
main solid white blob (entire 108dp tile tinted) cat silhouette tinted with dynamic color
.dev no adaptive XML → fallback tinting cat + DEV badge tinted with dynamic color

With Themed icons disabled (default on Android 12 and below, and most 13+ devices): unchanged on every variant — the existing foreground raster and background drawable are not modified.

Why the raster approach

The stock @mipmap/ic_launcher_foreground can't be reused as the monochrome source because its background is opaque white rather than transparent — tinting it produces a solid colored square. Instead, I derived a dedicated @mipmap/ic_launcher_monochrome at every density from the foreground with ffmpeg:

alpha = min(original_alpha, clip((220 - luma) × 8, 0, 255))
rgb = 255  // system tints at runtime; value is irrelevant

Black cat pixels (luma ≈ 0) become fully opaque; white-background and already-transparent pixels become fully transparent. The pink DEV badge in the debug foreground (luma ≈ 120) sits well below the threshold and is preserved fully opaque.

Files

  • app/src/main/res/mipmap-{mdpi..xxxhdpi}/ic_launcher_monochrome.png (new, 5 densities)
  • app/src/debug/res/mipmap-{mdpi..xxxhdpi}/ic_launcher_monochrome.png (new, 5 densities — debug-specific so the DEV badge survives)
  • app/src/main/res/mipmap-anydpi/ic_launcher{,_round}.xml (moved from mipmap-anydpi-v26, added <monochrome> line)
  • app/src/debug/res/mipmap-anydpi/ic_launcher{,_round}.xml (new — debug previously had no adaptive XML at all)

No existing icon file is modified (git diff against the foreground rasters, ic_launcher_background.xml, ic_launcher_foreground.xml, and raster fallbacks is empty).

Test plan

  • ./gradlew :app:clean :app:assembleDebug — succeeds
  • ./gradlew :app:lintDebug — succeeds, no new warnings
  • Extracted APK inspection: ic_launcher_monochrome.png packaged at all 5 densities for both variants, existing ic_launcher*.png byte-identical to main branch
  • Manual: SM-F711N (Android 14), Themed icons ON — main build shows tinted cat, .dev build shows tinted cat + DEV badge
  • Manual: same device, Themed icons OFF — icons render unchanged from previous release

🤖 Generated with Claude Code

Previously the adaptive-icon XMLs declared only background + foreground, so
on Android 13+ devices with Themed icons enabled, the launcher rendered an
unbranded white blob (the full 108dp foreground tile tinted with the
dynamic color). Wire up a proper monochrome layer so themed icons keep
the Hackers' Pub cat silhouette.

The stock @mipmap/ic_launcher_foreground raster can't be reused as the
monochrome source because its background is opaque white rather than
transparent — tinting it produces a solid colored square. Instead, add a
dedicated @mipmap/ic_launcher_monochrome PNG at every density, derived
from the foreground via ffmpeg: alpha = min(original_alpha, threshold
curve on luma) with RGB = white. Black cat pixels become fully opaque;
white-background and pre-existing transparent pixels become fully
transparent. The system tints the alpha-masked silhouette at runtime.

The .dev build gets its own monochrome asset so the themed icon preserves
the DEV badge that distinguishes the debug installation — the same luma
threshold works for the pink badge since it maps to mid-luma well below
the threshold.

The existing foreground rasters and background drawable are untouched, so
rendering with Themed icons disabled is unchanged on every device
(including pre-Android 13).

While here, drop the redundant -v26 qualifier from the adaptive-icon
folder: minSdk is already 26. Folder is now mipmap-anydpi/ for both
variants, and debug now has its own adaptive-icon XML (previously it only
had raster fallbacks and therefore didn't participate in themed icons at
all).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 00786ab7-1914-4057-b138-4524b5885bd4

📥 Commits

Reviewing files that changed from the base of the PR and between d7afce1 and 51fbd83.

⛔ Files ignored due to path filters (10)
  • app/src/debug/res/mipmap-hdpi/ic_launcher_monochrome.png is excluded by !**/*.png
  • app/src/debug/res/mipmap-mdpi/ic_launcher_monochrome.png is excluded by !**/*.png
  • app/src/debug/res/mipmap-xhdpi/ic_launcher_monochrome.png is excluded by !**/*.png
  • app/src/debug/res/mipmap-xxhdpi/ic_launcher_monochrome.png is excluded by !**/*.png
  • app/src/debug/res/mipmap-xxxhdpi/ic_launcher_monochrome.png is excluded by !**/*.png
  • app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png is excluded by !**/*.png
  • app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png is excluded by !**/*.png
  • app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png is excluded by !**/*.png
  • app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png is excluded by !**/*.png
  • app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png is excluded by !**/*.png
📒 Files selected for processing (4)
  • app/src/debug/res/mipmap-anydpi/ic_launcher.xml
  • app/src/debug/res/mipmap-anydpi/ic_launcher_round.xml
  • app/src/main/res/mipmap-anydpi/ic_launcher.xml
  • app/src/main/res/mipmap-anydpi/ic_launcher_round.xml

📝 Walkthrough

Walkthrough

This change adds Android adaptive icon resources for both regular and rounded icon variants. New adaptive icon XML files are created in the main resource directory, while debug variants are updated to include monochrome layer references for enhanced icon rendering support.

Changes

Cohort / File(s) Summary
Debug Adaptive Icons
app/src/debug/res/mipmap-anydpi/ic_launcher.xml, app/src/debug/res/mipmap-anydpi/ic_launcher_round.xml
Added monochrome drawable reference (@mipmap/ic_launcher_monochrome) to existing adaptive icon configurations.
Main Adaptive Icons
app/src/main/res/mipmap-anydpi/ic_launcher.xml, app/src/main/res/mipmap-anydpi/ic_launcher_round.xml
Created new adaptive icon resources with three layers: background (@drawable/ic_launcher_background), foreground (@mipmap/ic_launcher_foreground), and monochrome (@mipmap/ic_launcher_monochrome).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding Material You themed launcher icon with monochrome layer support for Android 13+ dynamic theming.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, covering the monochrome icon implementation, file modifications, technical approach, and testing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dalinaum
Copy link
Copy Markdown
Contributor Author

스크린샷 2026-04-20 오전 4 29 15

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 20, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@malkoG malkoG merged commit c78a5f3 into hackers-pub:main Apr 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants