From f0dfbd27ee408c50afe9d52ccfdaded4775d4c9a Mon Sep 17 00:00:00 2001 From: inotia00 Date: Tue, 5 Sep 2023 11:04:57 +0900 Subject: [PATCH] feat(music/amoled): patch now applies the amoled theme to the comment input box as well --- .../patches/music/general/amoled/patch/AmoledPatch.kt | 8 +++++++- .../fingerprints/litho}/LithoThemeFingerprint.kt | 2 +- .../litho/patch => shared/patch/litho}/LithoThemePatch.kt | 8 +++----- .../youtube/layout/theme/patch/GeneralThemePatch.kt | 2 +- .../seekbar/seekbarcolor/patch/SeekbarColorPatch.kt | 2 +- 5 files changed, 13 insertions(+), 9 deletions(-) rename src/main/kotlin/app/revanced/patches/{youtube/utils/litho/fingerprints => shared/fingerprints/litho}/LithoThemeFingerprint.kt (90%) rename src/main/kotlin/app/revanced/patches/{youtube/utils/litho/patch => shared/patch/litho}/LithoThemePatch.kt (90%) diff --git a/src/main/kotlin/app/revanced/patches/music/general/amoled/patch/AmoledPatch.kt b/src/main/kotlin/app/revanced/patches/music/general/amoled/patch/AmoledPatch.kt index 9bd33812b7..c49372158c 100644 --- a/src/main/kotlin/app/revanced/patches/music/general/amoled/patch/AmoledPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/general/amoled/patch/AmoledPatch.kt @@ -4,17 +4,23 @@ import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.music.utils.annotations.MusicCompatibility +import app.revanced.patches.shared.patch.litho.LithoThemePatch +import app.revanced.util.integrations.Constants.MUSIC_UTILS_PATH import org.w3c.dom.Element @Patch @Name("Amoled") -@Description("Applies pure black theme in flyout panels.") +@Description("Applies pure black theme on some components.") +@DependsOn([LithoThemePatch::class]) @MusicCompatibility class AmoledPatch : ResourcePatch { override fun execute(context: ResourceContext) { + LithoThemePatch.injectCall("$MUSIC_UTILS_PATH/LithoThemePatch;->applyLithoTheme(I)I") + context.xmlEditor["res/values/colors.xml"].use { editor -> val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/litho/fingerprints/LithoThemeFingerprint.kt b/src/main/kotlin/app/revanced/patches/shared/fingerprints/litho/LithoThemeFingerprint.kt similarity index 90% rename from src/main/kotlin/app/revanced/patches/youtube/utils/litho/fingerprints/LithoThemeFingerprint.kt rename to src/main/kotlin/app/revanced/patches/shared/fingerprints/litho/LithoThemeFingerprint.kt index e3530bb85f..f573e2fd5b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/litho/fingerprints/LithoThemeFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/shared/fingerprints/litho/LithoThemeFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.utils.litho.fingerprints +package app.revanced.patches.shared.fingerprints.litho import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/litho/patch/LithoThemePatch.kt b/src/main/kotlin/app/revanced/patches/shared/patch/litho/LithoThemePatch.kt similarity index 90% rename from src/main/kotlin/app/revanced/patches/youtube/utils/litho/patch/LithoThemePatch.kt rename to src/main/kotlin/app/revanced/patches/shared/patch/litho/LithoThemePatch.kt index 82690faa2a..6e7cddaa37 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/litho/patch/LithoThemePatch.kt +++ b/src/main/kotlin/app/revanced/patches/shared/patch/litho/LithoThemePatch.kt @@ -1,19 +1,17 @@ -package app.revanced.patches.youtube.utils.litho.patch +package app.revanced.patches.shared.patch.litho import app.revanced.extensions.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod -import app.revanced.patches.youtube.utils.litho.fingerprints.LithoThemeFingerprint +import app.revanced.patches.shared.fingerprints.litho.LithoThemeFingerprint import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c import com.android.tools.smali.dexlib2.iface.reference.MethodReference class LithoThemePatch : BytecodePatch( - listOf( - LithoThemeFingerprint - ) + listOf(LithoThemeFingerprint) ) { override fun execute(context: BytecodeContext) { diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/patch/GeneralThemePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/patch/GeneralThemePatch.kt index 4b5ef04c6e..58f6fb0dd7 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/patch/GeneralThemePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/patch/GeneralThemePatch.kt @@ -3,7 +3,7 @@ package app.revanced.patches.youtube.layout.theme.patch import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.patches.youtube.utils.litho.patch.LithoThemePatch +import app.revanced.patches.shared.patch.litho.LithoThemePatch import app.revanced.util.integrations.Constants.UTILS_PATH import org.w3c.dom.Element diff --git a/src/main/kotlin/app/revanced/patches/youtube/seekbar/seekbarcolor/patch/SeekbarColorPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/seekbar/seekbarcolor/patch/SeekbarColorPatch.kt index 5033fff9d2..6f2cb2aad8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/seekbar/seekbarcolor/patch/SeekbarColorPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/seekbar/seekbarcolor/patch/SeekbarColorPatch.kt @@ -11,11 +11,11 @@ import app.revanced.patcher.patch.PatchException import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod +import app.revanced.patches.shared.patch.litho.LithoThemePatch import app.revanced.patches.youtube.seekbar.seekbarcolor.fingerprints.ControlsOverlayStyleFingerprint import app.revanced.patches.youtube.seekbar.seekbarcolor.fingerprints.PlayerSeekbarColorFingerprint import app.revanced.patches.youtube.seekbar.seekbarcolor.fingerprints.ShortsSeekbarColorFingerprint import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility -import app.revanced.patches.youtube.utils.litho.patch.LithoThemePatch import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.InlineTimeBarColorizedBarPlayedColorDark import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.InlineTimeBarPlayedNotHighlightedColor