Skip to content

Commit d272ff4

Browse files
committed
feat(Custom branding): Use SVG for adaptive ReVanced icon
1 parent 603025a commit d272ff4

File tree

7 files changed

+87
-0
lines changed

7 files changed

+87
-0
lines changed

patches/src/main/kotlin/app/revanced/patches/music/layout/branding/CustomBrandingPatch.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ val customBrandingPatch = baseCustomBrandingPatch(
6868
"ic_launcher_release",
6969
),
7070
monochromeIconFileNames = arrayOf("ic_app_icons_themed_youtube_music.xml"),
71+
adaptiveIconFileNames = arrayOf(
72+
"adaptiveproduct_youtube_music_2024_q4_background_color_108.xml",
73+
"adaptiveproduct_youtube_music_2024_q4_foreground_color_108.xml",
74+
),
7175

7276
block = {
7377
dependsOn(disableSplashAnimationPatch)

patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/BaseCustomBrandingPatch.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ internal fun baseCustomBrandingPatch(
5454
resourceFolder: String,
5555
iconResourceFileNames: Array<String>,
5656
monochromeIconFileNames: Array<String>,
57+
adaptiveIconFileNames: Array<String>,
5758
block: ResourcePatchBuilder.() -> Unit = {},
5859
executeBlock: ResourcePatchContext.() -> Unit = {}
5960
): ResourcePatch = resourcePatch(
@@ -117,6 +118,14 @@ internal fun baseCustomBrandingPatch(
117118
ResourceGroup("drawable", fileName)
118119
)
119120
}
121+
122+
// Add SVG adaptive icon.
123+
adaptiveIconFileNames.forEach { fileName ->
124+
copyResources(
125+
resourceFolder,
126+
ResourceGroup("mipmap-anydpi", fileName)
127+
)
128+
}
120129
} else {
121130
val filePath = File(iconPathTrimmed)
122131
val resourceDirectory = get("res")

patches/src/main/kotlin/app/revanced/patches/youtube/layout/branding/CustomBrandingPatch.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ val customBrandingPatch = baseCustomBrandingPatch(
3131
"adaptive_monochrome_ic_youtube_launcher.xml",
3232
"ringo2_adaptive_monochrome_ic_youtube_launcher.xml"
3333
),
34+
adaptiveIconFileNames = arrayOf(
35+
"adaptiveproduct_youtube_background_color_108.xml",
36+
"adaptiveproduct_youtube_foreground_color_108.xml",
37+
),
3438

3539
block = {
3640
compatibleWith(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<shape xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:shape="rectangle">
4+
<solid android:color="#1B1B1B" />
5+
</shape>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:aapt="http://schemas.android.com/aapt"
3+
android:width="108dp"
4+
android:height="108dp"
5+
android:viewportWidth="256"
6+
android:viewportHeight="256">
7+
<group android:scaleX="0.3"
8+
android:scaleY="0.3"
9+
android:translateX="89.6"
10+
android:translateY="89.6">
11+
<path
12+
android:pathData="M250.09,13.49C251.39,10.51 251.11,7.08 249.33,4.36C247.55,1.64 244.52,0 241.27,0L228.81,0C226.08,0 223.61,1.62 222.51,4.11C211.54,29.1 153.63,160.99 134.29,205.04C133.2,207.54 130.73,209.15 128,209.15C125.27,209.15 122.8,207.54 121.7,205.04C102.36,160.99 44.46,29.1 33.49,4.11C32.39,1.62 29.92,0 27.19,0L14.73,0C11.48,0 8.45,1.64 6.67,4.36C4.89,7.08 4.61,10.51 5.91,13.49C26.64,60.8 95.56,218.1 109.63,250.24C111.17,253.74 114.63,256 118.45,256L137.55,256C141.37,256 144.83,253.74 146.36,250.24C160.44,218.1 229.36,60.8 250.09,13.49Z"
13+
android:fillColor="#ffffff"/>
14+
<path
15+
android:pathData="M135.14,123.87C133.67,126.43 130.94,128 128,128C125.05,128 122.33,126.43 120.85,123.87C105.89,97.97 71.44,38.28 56.48,12.37C55,9.82 55,6.68 56.48,4.12C57.95,1.57 60.68,-0 63.62,-0L192.37,-0C195.32,-0 198.04,1.57 199.52,4.12C200.99,6.68 200.99,9.82 199.52,12.37C184.56,38.28 150.1,97.97 135.14,123.87Z">
16+
<aapt:attr name="android:fillColor">
17+
<gradient
18+
android:startX="128"
19+
android:startY="-0"
20+
android:endX="128"
21+
android:endY="254.6"
22+
android:type="linear">
23+
<item android:offset="0" android:color="#FFF04E98"/>
24+
<item android:offset="0.5" android:color="#FF5F65D4"/>
25+
<item android:offset="1" android:color="#FF4E98F0"/>
26+
</gradient>
27+
</aapt:attr>
28+
</path>
29+
</group>
30+
</vector>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<shape xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:shape="rectangle">
4+
<solid android:color="#1B1B1B" />
5+
</shape>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:aapt="http://schemas.android.com/aapt"
3+
android:width="108dp"
4+
android:height="108dp"
5+
android:viewportWidth="256"
6+
android:viewportHeight="256">
7+
<group android:scaleX="0.3"
8+
android:scaleY="0.3"
9+
android:translateX="89.6"
10+
android:translateY="89.6">
11+
<path
12+
android:pathData="M250.09,13.49C251.39,10.51 251.11,7.08 249.33,4.36C247.55,1.64 244.52,0 241.27,0L228.81,0C226.08,0 223.61,1.62 222.51,4.11C211.54,29.1 153.63,160.99 134.29,205.04C133.2,207.54 130.73,209.15 128,209.15C125.27,209.15 122.8,207.54 121.7,205.04C102.36,160.99 44.46,29.1 33.49,4.11C32.39,1.62 29.92,0 27.19,0L14.73,0C11.48,0 8.45,1.64 6.67,4.36C4.89,7.08 4.61,10.51 5.91,13.49C26.64,60.8 95.56,218.1 109.63,250.24C111.17,253.74 114.63,256 118.45,256L137.55,256C141.37,256 144.83,253.74 146.36,250.24C160.44,218.1 229.36,60.8 250.09,13.49Z"
13+
android:fillColor="#ffffff"/>
14+
<path
15+
android:pathData="M135.14,123.87C133.67,126.43 130.94,128 128,128C125.05,128 122.33,126.43 120.85,123.87C105.89,97.97 71.44,38.28 56.48,12.37C55,9.82 55,6.68 56.48,4.12C57.95,1.57 60.68,-0 63.62,-0L192.37,-0C195.32,-0 198.04,1.57 199.52,4.12C200.99,6.68 200.99,9.82 199.52,12.37C184.56,38.28 150.1,97.97 135.14,123.87Z">
16+
<aapt:attr name="android:fillColor">
17+
<gradient
18+
android:startX="128"
19+
android:startY="-0"
20+
android:endX="128"
21+
android:endY="254.6"
22+
android:type="linear">
23+
<item android:offset="0" android:color="#FFF04E98"/>
24+
<item android:offset="0.5" android:color="#FF5F65D4"/>
25+
<item android:offset="1" android:color="#FF4E98F0"/>
26+
</gradient>
27+
</aapt:attr>
28+
</path>
29+
</group>
30+
</vector>

0 commit comments

Comments
 (0)