From a674b1af1cf0a326ba6a3678f0da26d6ba7558ce Mon Sep 17 00:00:00 2001 From: Aaron Veil <70171475+anddea@users.noreply.github.com> Date: Tue, 16 Apr 2024 14:50:35 +0300 Subject: [PATCH] feat(YouTube - Visual preferences icons): Icon for Extended setting based on `Custom branding icon` --- api/revanced-patches.api | 2 + .../branding/icon/CustomBrandingIconPatch.kt | 2 +- .../settings/VisualSettingsIconsPatch.kt | 36 +- .../revanced_extended_settings_key_icon.xml | 2032 ++++++++++ .../revanced_extended_settings_key_icon.xml | 2232 +++++++++++ .../revanced_extended_settings_key_icon.xml | 3288 ++++++++++++++++ .../revanced_extended_settings_key_icon.xml | 1034 ++++++ .../revanced_extended_settings_key_icon.xml | 1026 +++++ .../revanced_extended_settings_key_icon.xml | 1026 +++++ .../revanced_extended_settings_key_icon.xml | 1030 ++++++ .../revanced_extended_settings_key_icon.xml | 3294 +---------------- 11 files changed, 11716 insertions(+), 3286 deletions(-) create mode 100644 src/main/resources/youtube/branding/afn_blue/launcher/drawable/revanced_extended_settings_key_icon.xml create mode 100644 src/main/resources/youtube/branding/afn_red/launcher/drawable/revanced_extended_settings_key_icon.xml create mode 100644 src/main/resources/youtube/branding/mmt/launcher/drawable/revanced_extended_settings_key_icon.xml create mode 100755 src/main/resources/youtube/branding/revancify_blue/launcher/drawable/revanced_extended_settings_key_icon.xml create mode 100755 src/main/resources/youtube/branding/revancify_red/launcher/drawable/revanced_extended_settings_key_icon.xml create mode 100755 src/main/resources/youtube/branding/vanced_black/launcher/drawable/revanced_extended_settings_key_icon.xml create mode 100755 src/main/resources/youtube/branding/vanced_light/launcher/drawable/revanced_extended_settings_key_icon.xml diff --git a/api/revanced-patches.api b/api/revanced-patches.api index 28b1c0fd7..ad123367c 100644 --- a/api/revanced-patches.api +++ b/api/revanced-patches.api @@ -2042,6 +2042,8 @@ public final class app/revanced/patches/youtube/layout/branding/icon/CustomBrand public static final field INSTANCE Lapp/revanced/patches/youtube/layout/branding/icon/CustomBrandingIconPatch; public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V + public final fun getAppIcon ()Ljava/lang/String; + public final fun setAppIcon (Ljava/lang/String;)V } public final class app/revanced/patches/youtube/layout/branding/name/CustomBrandingNamePatch : app/revanced/patches/shared/patch/elements/AbstractRemoveStringsElementsPatch { diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/branding/icon/CustomBrandingIconPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/branding/icon/CustomBrandingIconPatch.kt index 5db236e1c..887b06885 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/branding/icon/CustomBrandingIconPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/branding/icon/CustomBrandingIconPatch.kt @@ -115,7 +115,7 @@ object CustomBrandingIconPatch : ResourcePatch() { "mdpi" ).map { "mipmap-$it" } - private var AppIcon by stringPatchOption( + var AppIcon by stringPatchOption( key = "AppIcon", default = DEFAULT_ICON_KEY, values = availableIcon, diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/settings/VisualSettingsIconsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/settings/VisualSettingsIconsPatch.kt index b54be1ceb..76297dd2d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/settings/VisualSettingsIconsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/settings/VisualSettingsIconsPatch.kt @@ -5,6 +5,7 @@ import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.booleanPatchOption +import app.revanced.patches.youtube.layout.branding.icon.CustomBrandingIconPatch import app.revanced.util.ResourceGroup import app.revanced.util.copyResources import org.w3c.dom.Document @@ -32,7 +33,15 @@ object VisualSettingsIconsPatch : ResourcePatch() { key = "ExtendedSettings", default = true, title = "Extended settings", - description = "Apply icons to extended main screen settings", + description = "Apply icons to Extended main screen settings", + required = true + ) + + private val ExtendedBrand by booleanPatchOption( + key = "ExtendedBrand", + default = false, + title = "Extended brand icon", + description = "Icon for Extended setting based on \"Custom branding icon\". If this option is enabled but \"Custom branding icon\" patch is excluded, it will use default custom branding icon.", required = true ) @@ -122,8 +131,6 @@ object VisualSettingsIconsPatch : ResourcePatch() { "captions_key", "accessibility_settings_key", "about_key", - - "revanced_extended_settings_key", ) val validExtendedTitles = setOf( @@ -145,6 +152,10 @@ object VisualSettingsIconsPatch : ResourcePatch() { "misc", ) + val validExtendedBrand = setOf( + "revanced_extended_settings_key", + ) + val emptyTitles = setOf( "revanced_custom_playback_speeds", "revanced_custom_playback_speed_panel_type", @@ -190,6 +201,7 @@ object VisualSettingsIconsPatch : ResourcePatch() { } val validMainTitlesIcons = validMainTitles.associateWith { "${it}_icon" } + val validExtendedBrandIcon = validExtendedBrand.associateWith { "${it}_icon" } val validExtendedTitlesIcons = validExtendedTitles.associateWith { title -> when (title) { @@ -209,6 +221,23 @@ object VisualSettingsIconsPatch : ResourcePatch() { if (MainSettings!!) resourcesToCopy.add(ResourceGroup("drawable", *validMainTitlesIcons.values.map { "$it.xml" }.toTypedArray())) if (ExtendedSettings!!) resourcesToCopy.add(ResourceGroup("drawable", *validExtendedTitlesIcons.values.map { "$it.xml" }.toTypedArray())) + CustomBrandingIconPatch.AppIcon?.let { appIcon -> + val appIconValue = appIcon.lowercase().replace(" ", "_") + val resourcePath = "youtube/branding/$appIconValue" + + if (ExtendedBrand!!) { + arrayOf( + ResourceGroup( + "drawable", "revanced_extended_settings_key_icon.xml" + ) + ).forEach { resourceGroup -> + context.copyResources("$resourcePath/launcher", resourceGroup) + } + } else { + resourcesToCopy.add(ResourceGroup("drawable", *validExtendedBrandIcon.values.map { "$it.xml" }.toTypedArray())) + } + } + resourcesToCopy.forEach { context.copyResources("youtube/settings", it) } val tagNames = listOf( @@ -235,6 +264,7 @@ object VisualSettingsIconsPatch : ResourcePatch() { title in validTitles -> validTitlesIcons[title] MainSettings!! && title in validMainTitles -> validMainTitlesIcons[title] ExtendedSettings!! && title in validExtendedTitles -> validExtendedTitlesIcons[title] + title in validExtendedBrand -> validExtendedBrandIcon[title] title in emptyTitles -> emptyIcon else -> null } diff --git a/src/main/resources/youtube/branding/afn_blue/launcher/drawable/revanced_extended_settings_key_icon.xml b/src/main/resources/youtube/branding/afn_blue/launcher/drawable/revanced_extended_settings_key_icon.xml new file mode 100644 index 000000000..ede82d9f1 --- /dev/null +++ b/src/main/resources/youtube/branding/afn_blue/launcher/drawable/revanced_extended_settings_key_icon.xml @@ -0,0 +1,2032 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/youtube/branding/afn_red/launcher/drawable/revanced_extended_settings_key_icon.xml b/src/main/resources/youtube/branding/afn_red/launcher/drawable/revanced_extended_settings_key_icon.xml new file mode 100644 index 000000000..bc9942311 --- /dev/null +++ b/src/main/resources/youtube/branding/afn_red/launcher/drawable/revanced_extended_settings_key_icon.xml @@ -0,0 +1,2232 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/youtube/branding/mmt/launcher/drawable/revanced_extended_settings_key_icon.xml b/src/main/resources/youtube/branding/mmt/launcher/drawable/revanced_extended_settings_key_icon.xml new file mode 100644 index 000000000..085d98c17 --- /dev/null +++ b/src/main/resources/youtube/branding/mmt/launcher/drawable/revanced_extended_settings_key_icon.xml @@ -0,0 +1,3288 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/youtube/branding/revancify_blue/launcher/drawable/revanced_extended_settings_key_icon.xml b/src/main/resources/youtube/branding/revancify_blue/launcher/drawable/revanced_extended_settings_key_icon.xml new file mode 100755 index 000000000..c088bcfcc --- /dev/null +++ b/src/main/resources/youtube/branding/revancify_blue/launcher/drawable/revanced_extended_settings_key_icon.xml @@ -0,0 +1,1034 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/youtube/branding/revancify_red/launcher/drawable/revanced_extended_settings_key_icon.xml b/src/main/resources/youtube/branding/revancify_red/launcher/drawable/revanced_extended_settings_key_icon.xml new file mode 100755 index 000000000..98cfb9ccc --- /dev/null +++ b/src/main/resources/youtube/branding/revancify_red/launcher/drawable/revanced_extended_settings_key_icon.xml @@ -0,0 +1,1026 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/youtube/branding/vanced_black/launcher/drawable/revanced_extended_settings_key_icon.xml b/src/main/resources/youtube/branding/vanced_black/launcher/drawable/revanced_extended_settings_key_icon.xml new file mode 100755 index 000000000..fd9e32b72 --- /dev/null +++ b/src/main/resources/youtube/branding/vanced_black/launcher/drawable/revanced_extended_settings_key_icon.xml @@ -0,0 +1,1026 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/youtube/branding/vanced_light/launcher/drawable/revanced_extended_settings_key_icon.xml b/src/main/resources/youtube/branding/vanced_light/launcher/drawable/revanced_extended_settings_key_icon.xml new file mode 100755 index 000000000..6cdec1e38 --- /dev/null +++ b/src/main/resources/youtube/branding/vanced_light/launcher/drawable/revanced_extended_settings_key_icon.xml @@ -0,0 +1,1030 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/youtube/settings/drawable/revanced_extended_settings_key_icon.xml b/src/main/resources/youtube/settings/drawable/revanced_extended_settings_key_icon.xml index 085d98c17..c1c480339 100644 --- a/src/main/resources/youtube/settings/drawable/revanced_extended_settings_key_icon.xml +++ b/src/main/resources/youtube/settings/drawable/revanced_extended_settings_key_icon.xml @@ -1,3288 +1,18 @@ - + android:height="48dp" + android:viewportWidth="960" + android:viewportHeight="960"> + android:pivotX="480" + android:pivotY="480"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:name="path" + android:pathData="M 359.846 800 L 190.769 800 Q 178.481 800 169.24 790.76 Q 160 781.519 160 769.231 L 160 600.154 Q 192.461 588.231 213.192 560.654 Q 233.923 533.077 233.923 498.538 Q 233.923 464 213.192 436.808 Q 192.461 409.615 160 396.923 L 160 227.846 Q 160 215.558 169.24 206.317 Q 178.481 197.077 190.769 197.077 L 358.538 197.077 Q 374.154 164 401.115 144.307 Q 428.077 124.615 462.308 124.615 Q 496.539 124.615 523.5 144.307 Q 550.462 164 566.077 197.077 L 732.154 197.077 Q 744.442 197.077 753.683 206.317 Q 762.923 215.558 762.923 227.846 L 762.923 393.923 Q 796 409.538 814.962 437.346 Q 833.923 465.154 833.923 499.385 Q 833.923 533.615 814.962 559.846 Q 796 586.077 762.923 601.692 L 762.923 769.231 Q 762.923 781.519 753.683 790.76 Q 744.442 800 732.154 800 L 563.077 800 Q 549.615 765.077 521.627 745.577 Q 493.638 726.077 461.281 726.077 Q 428.923 726.077 400.731 745.577 Q 372.538 765.077 359.846 800 Z M 190.769 769.231 L 343.846 769.231 Q 361.154 732.077 393.102 713.692 Q 425.05 695.308 461.487 695.308 Q 497.923 695.308 529.846 713.692 Q 561.769 732.077 579.077 769.231 L 732.154 769.231 L 732.154 575.769 L 734.077 575.769 Q 768.693 571.154 785.923 548.923 Q 803.154 526.692 803.154 499.769 Q 803.154 472.846 785.923 450.231 Q 768.693 427.616 734.077 423 L 732.154 423 L 732.154 227.846 L 538.692 227.846 L 538.692 224.461 Q 534.077 189.846 511.846 172.615 Q 489.615 155.384 462.308 155.384 Q 435 155.384 412.769 172.615 Q 390.539 189.846 385.923 224.461 L 385.923 227.846 L 190.769 227.846 L 190.769 378.615 Q 225.842 394.893 245.267 427.694 Q 264.692 460.494 264.692 498.761 Q 264.692 536.869 245.192 569.819 Q 225.692 602.769 190.769 618.462 L 190.769 769.231 Z M 462.692 499.769 Z" + android:fillColor="?ytTextPrimary" /> - \ No newline at end of file +