From 5656d2c0551e13db7eabca249ae38dfd52d9233e Mon Sep 17 00:00:00 2001 From: Gray Zhang Date: Sun, 19 Oct 2025 13:49:57 +0800 Subject: [PATCH 1/4] feat: Add Android Adaptive Icons support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../main/res/drawable/ic_launcher_background.xml | 10 ++++++++++ .../main/res/drawable/ic_launcher_foreground.xml | 14 ++++++++++++++ app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml | 6 ++++++ .../res/mipmap-anydpi-v26/ic_launcher_round.xml | 6 ++++++ 4 files changed, 36 insertions(+) create mode 100644 app/src/main/res/drawable/ic_launcher_background.xml create mode 100644 app/src/main/res/drawable/ic_launcher_foreground.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..7e5af4e3 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,10 @@ + + + + diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 00000000..65a3cb5e --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,14 @@ + + + + + diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000..b3e26b4c --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 00000000..b3e26b4c --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,6 @@ + + + + + + From c4d0579fa61273ec3c410c686a9ba8de6e6982a5 Mon Sep 17 00:00:00 2001 From: Gray Zhang Date: Sun, 19 Oct 2025 13:58:07 +0800 Subject: [PATCH 2/4] docs: Add documentation comments for adaptive icon scaling calculations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- app/src/main/res/drawable/ic_launcher_foreground.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml index 65a3cb5e..1edc5a84 100644 --- a/app/src/main/res/drawable/ic_launcher_foreground.xml +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -3,6 +3,10 @@ android:height="108dp" android:viewportWidth="108" android:viewportHeight="108"> + Date: Sun, 19 Oct 2025 14:02:25 +0800 Subject: [PATCH 3/4] fix: Add dark mode support for adaptive icon background MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- app/src/main/res/values-night/ic_launcher_background.xml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 app/src/main/res/values-night/ic_launcher_background.xml diff --git a/app/src/main/res/values-night/ic_launcher_background.xml b/app/src/main/res/values-night/ic_launcher_background.xml new file mode 100644 index 00000000..77a9b30c --- /dev/null +++ b/app/src/main/res/values-night/ic_launcher_background.xml @@ -0,0 +1,5 @@ + + + + #111214 + From 0f4134eee0ee4a810a0907b78319dfc58c924406 Mon Sep 17 00:00:00 2001 From: Gray Zhang Date: Sun, 19 Oct 2025 14:11:25 +0800 Subject: [PATCH 4/4] fix: Center adaptive icon logo horizontally MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../res/drawable/ic_launcher_foreground.xml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml index 1edc5a84..8a85a085 100644 --- a/app/src/main/res/drawable/ic_launcher_foreground.xml +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -4,13 +4,16 @@ android:viewportWidth="108" android:viewportHeight="108"> - + Original logo viewport: 1024x1024, but path content is ~285-720 (435px wide, center ~502) + Logo is slightly off-center in original viewport (should be 512 but is ~502) + Scale: 0.0645 to fit 66dp safe zone (1024 * 0.0645 ≈ 66) + Base translation: 21 = (108 - 66) / 2 for safe zone centering + X adjustment: +0.65 to compensate for logo being off-center in viewport + Final: translateX = 21.65, translateY = 21 --> +