Modern Apps git

← Modern-Apps.git

fix icons

Commit
ac4659aa810c890914edfd13e4a68c749085a64f
Author
Vayun Mathur <[email protected]>
When
2026-07-17 01:48 UTC (4 months ago)
Parents
4dceb92

Diff

build-logic/src/main/kotlin/LauncherIconGen.kt
diff --git a/build-logic/src/main/kotlin/LauncherIconGen.kt b/build-logic/src/main/kotlin/LauncherIconGen.ktindex 80566e0db2..262e0d434c 100644--- a/build-logic/src/main/kotlin/LauncherIconGen.kt+++ b/build-logic/src/main/kotlin/LauncherIconGen.kt@@ -19,6 +19,13 @@ import java.net.URI interface LauncherIconExtension {     /** Material Symbols name, e.g. "calendar_month" (the `materialsymbolsoutlined` style). */     val symbol: Property<String>++    /**+     * Fraction of the 960 viewport the symbol occupies within the adaptive-icon+     * safe zone. Defaults to 0.58; lower values render a smaller glyph with more+     * padding. The translate is derived so the glyph stays centered.+     */+    val scale: Property<Double> }  // Downloads the outlined Material Symbol at [ref], wraps its path in the standard@@ -32,6 +39,9 @@ abstract class GenerateLauncherIconTask : DefaultTask() {     @get:Input     abstract val ref: Property<String> +    @get:Input+    abstract val scale: Property<Double>+     @get:Internal     abstract val cacheDir: DirectoryProperty @@ -78,18 +88,20 @@ abstract class GenerateLauncherIconTask : DefaultTask() {         return text     } -    private fun wrap(pathData: String): String =-        """+    private fun wrap(pathData: String): String {+        val s = scale.get()+        val translate = (VIEWPORT - VIEWPORT * s) / 2.0+        return """         |<vector xmlns:android="http://schemas.android.com/apk/res/android"         |    android:width="108dp"         |    android:height="108dp"         |    android:viewportWidth="960"         |    android:viewportHeight="960"         |    android:tint="#000000">-        |  <group android:scaleX="0.58"-        |      android:scaleY="0.58"-        |      android:translateX="201.6"-        |      android:translateY="201.6">+        |  <group android:scaleX="${fmt(s)}"+        |      android:scaleY="${fmt(s)}"+        |      android:translateX="${fmt(translate)}"+        |      android:translateY="${fmt(translate)}">         |    <path         |        android:fillColor="@android:color/white"         |        android:pathData="$pathData"/>@@ -97,8 +109,15 @@ abstract class GenerateLauncherIconTask : DefaultTask() {         |</vector>         |         """.trimMargin()+    }++    private fun fmt(v: Double): String {+        val s = v.toString()+        return if (s.endsWith(".0")) s.dropLast(2) else s+    }      private companion object {+        const val VIEWPORT = 960.0         val PATH_DATA = Regex("""android:pathData="([^"]*)"""")     } }
build-logic/src/main/kotlin/common-conventions-app.gradle.kts
diff --git a/build-logic/src/main/kotlin/common-conventions-app.gradle.kts b/build-logic/src/main/kotlin/common-conventions-app.gradle.ktsindex c5e1ea2b39..0fcf670a42 100644--- a/build-logic/src/main/kotlin/common-conventions-app.gradle.kts+++ b/build-logic/src/main/kotlin/common-conventions-app.gradle.kts@@ -31,7 +31,9 @@ val (appVersionCode, appVersionName) = readVersionInfo() // The symbol path is downloaded from google/material-design-icons pinned at this // commit for reproducible builds, wrapped in the standard foreground vector, and // wired into every variant's generated res.-val launcherIcon = extensions.create("launcherIcon", LauncherIconExtension::class.java)+val launcherIcon = extensions.create("launcherIcon", LauncherIconExtension::class.java).apply {+    scale.convention(0.58)+} val materialSymbolsRef = "819d78680a849ceef4c78f863d8753e3160b7c89" val materialSymbolsCache = File(gradle.gradleUserHomeDir, "material-symbols-cache") @@ -42,6 +44,7 @@ extensions.configure<com.android.build.api.variant.ApplicationAndroidComponentsE             GenerateLauncherIconTask::class.java,         ) {             symbol.set(launcherIcon.symbol)+            scale.set(launcherIcon.scale)             ref.set(materialSymbolsRef)             cacheDir.set(materialSymbolsCache)         }
findfamily/build.gradle.kts
diff --git a/findfamily/build.gradle.kts b/findfamily/build.gradle.ktsindex dd254864f2..dbc0f10ca7 100644--- a/findfamily/build.gradle.kts+++ b/findfamily/build.gradle.kts@@ -5,7 +5,7 @@ plugins { }  launcherIcon {-    symbol = "share_location"+    symbol = "moved_location" }  android {
games/wordmaker/build.gradle.kts
diff --git a/games/wordmaker/build.gradle.kts b/games/wordmaker/build.gradle.ktsindex c4787f0eb9..cec84bbe7a 100644--- a/games/wordmaker/build.gradle.kts+++ b/games/wordmaker/build.gradle.kts@@ -5,6 +5,7 @@ plugins {  launcherIcon {     symbol = "crossword"+    scale = 0.5 }  android {
openassistant/build.gradle.kts
diff --git a/openassistant/build.gradle.kts b/openassistant/build.gradle.ktsindex 3ae6fe965d..1a12d72c05 100644--- a/openassistant/build.gradle.kts+++ b/openassistant/build.gradle.kts@@ -5,7 +5,7 @@ plugins { }  launcherIcon {-    symbol = "smart_toy"+    symbol = "robot_2" }  android {