Skip to content

Conversation

@graycreate
Copy link
Member

Summary

Implement Android Adaptive Icons to provide modern launcher icon support for Android 8.0 (API 26) and above, following official Android design guidelines.

Changes

  • ✅ Create mipmap-anydpi-v26 directory with adaptive icon descriptors
  • ✅ Add ic_launcher_foreground.xml with V2EX logo optimized for 108dp canvas
  • ✅ Add ic_launcher_background.xml with solid color background
  • ✅ Support monochrome layer for Android 13+ Material You theming
  • ✅ Maintain backward compatibility with existing PNG icons for older Android versions

Technical Details

Adaptive Icon Structure

  • 108x108dp canvas - Total size per Android requirements
  • 66x66dp safe zone - Inner area that won't be clipped by device-specific masks
  • Two layers: Background (solid color) + Foreground (V2EX logo from logo_svg.xml)
  • Monochrome support: Enables Android 13+ themed icons

Theme Support

The foreground layer respects existing theme colors:

  • Light theme: Dark logo (#FF111214)
  • Dark theme: White logo (#FFFFFFFF)

Device Compatibility

  • API 26+: Uses new adaptive icons with automatic shape adaptation
  • API < 26: Falls back to existing PNG launcher icons
  • Supports all launcher icon shapes (circle, squircle, rounded square, etc.)

Benefits

  1. Modern Android support - Follows latest Android design guidelines
  2. Device flexibility - Automatically adapts to different launcher icon shapes
  3. Material You theming - Supports Android 13+ monochrome theming
  4. Backward compatible - Existing PNG icons still work for older devices
  5. Brand consistency - Uses existing V2EX logo assets

Testing

  • Build successful
  • Installed and tested on Android 13 device (SM-G9810)
  • Visual verification on launcher
  • Test different icon shapes (if launcher supports)
  • Test Material You theming on Android 13+

Screenshots

Please add screenshots showing the adaptive icon on your device launcher

🤖 Generated with Claude Code

Implement adaptive icons for Android 8.0 (API 26) and above following official Android guidelines.

Changes:
- Create mipmap-anydpi-v26 directory with ic_launcher.xml and ic_launcher_round.xml
- Add ic_launcher_foreground.xml with V2EX logo scaled for 108dp canvas
- Add ic_launcher_background.xml with solid color background
- Support monochrome layer for Android 13+ Material You theming
- Maintain backward compatibility with existing PNG icons for older devices

The implementation uses the existing logo_svg.xml and respects day/night theme colors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings October 19, 2025 05:50
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements Android Adaptive Icons support for the V2EX client app, providing modern launcher icon capabilities for Android 8.0+ while maintaining backward compatibility with older versions.

  • Adds adaptive icon descriptors for both standard and round launcher icons
  • Creates foreground layer using existing V2EX logo with proper scaling for 108dp canvas
  • Implements solid color background layer and monochrome support for Material You theming

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml Standard adaptive icon descriptor with background, foreground, and monochrome layers
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml Round adaptive icon descriptor (identical to standard)
app/src/main/res/drawable/ic_launcher_foreground.xml Vector drawable for foreground layer using scaled V2EX logo
app/src/main/res/drawable/ic_launcher_background.xml Vector drawable for solid color background layer

Comment on lines 6 to 9
<group android:scaleX="0.061"
android:scaleY="0.061"
android:translateX="21.06"
android:translateY="21.06">
Copy link

Copilot AI Oct 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The magic numbers 0.061 and 21.06 should be documented with comments explaining the calculation. Consider adding comments to clarify that these values position the logo within the 66x66dp safe zone of the 108x108dp canvas.

Copilot uses AI. Check for mistakes.
graycreate and others added 3 commits October 19, 2025 13:58
Address Copilot review feedback by adding detailed comments explaining
the magic numbers used for scaling and positioning the logo within the
adaptive icon safe zone.

- Document 108x108dp canvas and 66x66dp safe zone dimensions
- Explain scale factor calculation: 0.061 ≈ 66dp / 1024 viewport
- Explain translation calculation: 21.06 = (108dp - 66dp) / 2

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Fix launcher icon visibility issue in dark mode where white background
made the white logo invisible.

Changes:
- Add values-night/ic_launcher_background.xml with dark color (#111214)
- Dark background ensures white logo remains visible in night mode
- Matches the app's night theme color scheme (night_default_page_bg)
- Light mode continues to use light background (#EEEEEE)

Before: White icon on white background (invisible in dark mode)
After: White icon on dark background (visible in dark mode)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Fix horizontal alignment issue where the logo appeared slightly
left-aligned in the adaptive icon.

Root cause analysis:
- Original logo SVG has viewport 1024x1024
- Logo path content spans ~285-720px (center at ~502px)
- Logo is inherently off-center by ~10px in original viewport
- Previous centering calculation assumed logo was centered in viewport

Changes:
- Adjust scale from 0.061 to 0.0645 for better fit
- Increase translateX from 21.06 to 21.65 to compensate for logo offset
- Keep translateY at 21 (vertical centering is correct)
- Add detailed comments explaining the offset calculation

Result: Logo now appears properly centered in adaptive icon canvas

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@graycreate graycreate merged commit 1ccd6b0 into main Oct 19, 2025
5 checks passed
@graycreate graycreate deleted the feature/adaptive-icons branch October 19, 2025 07:04
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