Skip to content

Unofficial YouTube Music / Spotify Premium client for Android, built in Liquid Glass. Audio effects, Spotify Connect, listening history, 8 languages. Rust core on librespot.

Regenerate icons from source, sized by the wave

Lelonio0219e3642958
diff --git a/.claude/settings.local.json b/.claude/settings.local.json
index ec2bf16..bceed29 100644
--- a/.claude/settings.local.json
+++ b/.claude/settings.local.json
@@ -132,7 +132,9 @@
"Bash(git commit -q -m 'Fit the wave inside the adaptive icon'\\\\''s safe zone *)",
"Bash(file app/icon-src/*)",
"Bash(python3 -c \"import PIL; print\\(PIL.__version__\\)\")",
- "Bash(git commit -q -m 'Use the supplied icon artwork *)"
+ "Bash(git commit -q -m 'Use the supplied icon artwork *)",
+ "Bash(python3 tools/icon.py)",
+ "Bash(git commit -q -m 'Regenerate icons from source, sized by the wave *)"
]
}
}
diff --git a/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin b/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin
index ea816cb..b416903 100644
--- a/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin
+++ b/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin
@@ -2,27 +2,27 @@ C/C++ Structured Logl
j
h/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/additional_project_files.txtC
A
-?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  �̟��3  ����3i
+?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  �����3  ����3i
g
-e/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/android_gradle_build.json  �̟��3� ����3n
+e/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/android_gradle_build.json  �����3� ����3n
l
-j/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/android_gradle_build_mini.json  �̟��3� �����3[
+j/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/android_gradle_build_mini.json  �����3� �����3[
Y
-W/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build.ninja  �̟��3�� ����3_
+W/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build.ninja  �����3�� ����3_
]
-[/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build.ninja.txt  �̟��3d
+[/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build.ninja.txt  �����3d
b
-`/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build_file_index.txt  �̟��3 @ ����3e
+`/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build_file_index.txt  �����3 @ ����3e
c
-a/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/compile_commands.json  �̟��3�� ����3i
+a/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/compile_commands.json  �����3�� ����3i
g
-e/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/compile_commands.json.bin  �̟��3 �" ����3o
+e/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/compile_commands.json.bin  �����3 �" ����3o
m
-k/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/metadata_generation_command.txt  �̟��3
+k/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/metadata_generation_command.txt  �����3
� ����3b
`
-^/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/prefab_config.json  �̟��3  ( ����3g
+^/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/prefab_config.json  �����3  ( ����3g
e
-c/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/symbol_folder_index.txt  �̟��3  b ����3D
+c/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/symbol_folder_index.txt  �����3  b ����3D
B
-@/Users/emanuele/Progetto Spotify/app/src/main/cpp/CMakeLists.txt  �̟��3 � �Ȅ��3
\ No newline at end of file
+@/Users/emanuele/Progetto Spotify/app/src/main/cpp/CMakeLists.txt  �����3 � �Ȅ��3
\ No newline at end of file
diff --git a/app/icon-src/light.png b/app/icon-src/light.png
index 1876fe8..8d09611 100644
Binary files a/app/icon-src/light.png and b/app/icon-src/light.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
index 2b43889..f36fc8a 100644
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
index 9ec21f9..7cd805e 100644
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
index 2b43889..f36fc8a 100644
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
index 6a7f2dc..79bdac5 100644
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
index 6d6ffcb..6029cd0 100644
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
index 6a7f2dc..79bdac5 100644
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-night-hdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-night-hdpi/ic_launcher_foreground.png
index 1e77e5d..c306865 100644
Binary files a/app/src/main/res/mipmap-night-hdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-night-hdpi/ic_launcher_foreground.png differ
diff --git a/app/src/main/res/mipmap-night-mdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-night-mdpi/ic_launcher_foreground.png
index 3f515e8..553af2f 100644
Binary files a/app/src/main/res/mipmap-night-mdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-night-mdpi/ic_launcher_foreground.png differ
diff --git a/app/src/main/res/mipmap-night-xhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-night-xhdpi/ic_launcher_foreground.png
index 6aa3c19..8e7c42e 100644
Binary files a/app/src/main/res/mipmap-night-xhdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-night-xhdpi/ic_launcher_foreground.png differ
diff --git a/app/src/main/res/mipmap-night-xxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-night-xxhdpi/ic_launcher_foreground.png
index fa49e5f..e321fdc 100644
Binary files a/app/src/main/res/mipmap-night-xxhdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-night-xxhdpi/ic_launcher_foreground.png differ
diff --git a/app/src/main/res/mipmap-night-xxxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-night-xxxhdpi/ic_launcher_foreground.png
index 4dbfae3..28b9f24 100644
Binary files a/app/src/main/res/mipmap-night-xxxhdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-night-xxxhdpi/ic_launcher_foreground.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
index 656b16c..84bbd18 100644
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
index 36fd21d..5eda844 100644
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
index 656b16c..84bbd18 100644
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
index b462a4b..8e3a55b 100644
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
index 92f05bf..ab7fcd1 100644
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
index b462a4b..8e3a55b 100644
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
index 924304e..ba80b70 100644
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
index f4f9924..d157474 100644
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
index 924304e..ba80b70 100644
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml
index abb4db5..1c06a1f 100644
--- a/app/src/main/res/values-night/colors.xml
+++ b/app/src/main/res/values-night/colors.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <!-- Sampled from the dark plate. -->
+ <!-- Sampled from the icon's own plate by tools/icon.py, so the
+ adaptive icon's background and its artwork meet invisibly. -->
<color name="ic_launcher_background">#1C1C1E</color>
</resources>
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 4d003c8..379c6f0 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <!-- Sampled from the icon's own plate, so the two meet invisibly. -->
+ <!-- Sampled from the icon's own plate by tools/icon.py, so the
+ adaptive icon's background and its artwork meet invisibly. -->
<color name="ic_launcher_background">#C7C7CD</color>
</resources>
diff --git a/tools/icon.py b/tools/icon.py
new file mode 100644
index 0000000..e8ad009
--- /dev/null
+++ b/tools/icon.py
@@ -0,0 +1,116 @@
+"""Turns app/icon-src/{light,dark}.png into every icon resource the app ships.
+
+Run it after changing either source:
+
+ python3 tools/icon.py
+
+The one thing this does that a plain resize would not is size the artwork by
+*the wave*, not by the image. An adaptive icon is 108 units wide, of which the
+launcher shows 72 and guarantees only the middle 66; the sources fill their
+canvas to different extents, so scaling them alike would leave one cropped and
+the other adrift. The wave's bounding box is measured and scaled to the safe
+zone, and the rest of the canvas is filled with the plate's own colour, so
+whatever mask the launcher applies cuts into flat colour rather than into the
+mark.
+"""
+
+from PIL import Image
+import os
+
+DENSITIES = {"mdpi": 1, "hdpi": 1.5, "xhdpi": 2, "xxhdpi": 3, "xxxhdpi": 4}
+
+FOREGROUND_DP = 108
+SAFE_DP = 66
+LEGACY_DP = 48
+
+RES = "app/src/main/res"
+
+
+def plate_colour(img):
+ """The plate's colour, read where the mark never reaches.
+
+ The corner is tried first and is right for a source that fills its canvas.
+ One drawn as a rounded plate on transparency has nothing there, so the
+ fallback reads just inside the top edge instead.
+ """
+ corner = img.getpixel((4, 4))
+ if corner[3] >= 8:
+ return corner
+ return img.getpixel((img.width // 2, round(img.height * 0.08)))
+
+
+def wave_bounds(img, plate):
+ """The mark's bounding box: everything that is not the plate colour."""
+ pixels = img.load()
+ tolerance = 30
+ left, top, right, bottom = img.width, img.height, 0, 0
+ for y in range(0, img.height, 2):
+ for x in range(0, img.width, 2):
+ r, g, b, a = pixels[x, y]
+ if a < 8:
+ continue
+ if abs(r - plate[0]) + abs(g - plate[1]) + abs(b - plate[2]) < tolerance:
+ continue
+ left, top = min(left, x), min(top, y)
+ right, bottom = max(right, x), max(bottom, y)
+ return left, top, right, bottom
+
+
+def build(variant, suffix):
+ src = Image.open(f"app/icon-src/{variant}.png").convert("RGBA")
+ plate = plate_colour(src)
+ left, top, right, bottom = wave_bounds(src, plate)
+ mark = max(right - left, bottom - top)
+
+ for density, density_scale in DENSITIES.items():
+ canvas_px = round(FOREGROUND_DP * density_scale)
+ safe_px = round(SAFE_DP * density_scale)
+
+ # Scale the whole image by what the *mark* needs, then centre the image
+ # on the mark rather than on itself: the sources are not all centred.
+ scale = safe_px / mark
+ art = src.resize(
+ (max(1, round(src.width * scale)), max(1, round(src.height * scale))),
+ Image.LANCZOS,
+ )
+ mark_centre = ((left + right) / 2 * scale, (top + bottom) / 2 * scale)
+
+ canvas = Image.new("RGBA", (canvas_px, canvas_px), plate)
+ canvas.paste(
+ art,
+ (round(canvas_px / 2 - mark_centre[0]), round(canvas_px / 2 - mark_centre[1])),
+ art,
+ )
+
+ out = f"{RES}/mipmap{suffix}-{density}"
+ os.makedirs(out, exist_ok=True)
+ canvas.save(f"{out}/ic_launcher_foreground.png")
+
+ # The whole icon, for launchers older than adaptive icons.
+ legacy_px = round(LEGACY_DP * density_scale)
+ legacy = src.resize((legacy_px, legacy_px), Image.LANCZOS)
+ legacy.save(f"{out}/ic_launcher.png")
+ legacy.save(f"{out}/ic_launcher_round.png")
+
+ return plate
+
+
+def colours_xml(colour):
+ return (
+ '<?xml version="1.0" encoding="utf-8"?>\n'
+ "<resources>\n"
+ " <!-- Sampled from the icon's own plate by tools/icon.py, so the\n"
+ " adaptive icon's background and its artwork meet invisibly. -->\n"
+ f' <color name="ic_launcher_background">#{colour[0]:02X}{colour[1]:02X}{colour[2]:02X}</color>\n'
+ "</resources>\n"
+ )
+
+
+light = build("light", "")
+dark = build("dark", "-night")
+
+open(f"{RES}/values/colors.xml", "w").write(colours_xml(light))
+os.makedirs(f"{RES}/values-night", exist_ok=True)
+open(f"{RES}/values-night/colors.xml", "w").write(colours_xml(dark))
+
+print("light plate", light, "dark plate", dark)