diff --git a/src/main/kotlin/app/revanced/patches/music/layout/doubletapbackground/DoubleTapOverlayBackgroundPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/doubletapbackground/DoubleTapOverlayBackgroundPatch.kt deleted file mode 100644 index 56620eded..000000000 --- a/src/main/kotlin/app/revanced/patches/music/layout/doubletapbackground/DoubleTapOverlayBackgroundPatch.kt +++ /dev/null @@ -1,21 +0,0 @@ -package app.revanced.patches.music.layout.doubletapbackground - -import app.revanced.patcher.data.ResourceContext -import app.revanced.patches.music.utils.compatibility.Constants.COMPATIBLE_PACKAGE -import app.revanced.patches.shared.overlaybackground.OverlayBackgroundUtils.removeOverlayBackground -import app.revanced.util.patch.BaseResourcePatch - -@Suppress("unused") -object DoubleTapOverlayBackgroundPatch : BaseResourcePatch( - name = "Hide double tap overlay filter", - description = "Removes, at compile time, the dark overlay that appears when double-tapping to seek.", - compatiblePackages = COMPATIBLE_PACKAGE, - use = false -) { - override fun execute(context: ResourceContext) { - context.removeOverlayBackground( - arrayOf("quick_seek_overlay.xml"), - arrayOf("tap_bloom_view", "dark_background") - ) - } -} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/music/player/components/PlayerComponentsPatch.kt b/src/main/kotlin/app/revanced/patches/music/player/components/PlayerComponentsPatch.kt index 1381a8782..ac0534363 100644 --- a/src/main/kotlin/app/revanced/patches/music/player/components/PlayerComponentsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/player/components/PlayerComponentsPatch.kt @@ -29,6 +29,7 @@ import app.revanced.patches.music.player.components.fingerprints.OldEngagementPa import app.revanced.patches.music.player.components.fingerprints.OldPlayerBackgroundFingerprint import app.revanced.patches.music.player.components.fingerprints.OldPlayerLayoutFingerprint import app.revanced.patches.music.player.components.fingerprints.PlayerPatchConstructorFingerprint +import app.revanced.patches.music.player.components.fingerprints.QuickSeekOverlayFingerprint import app.revanced.patches.music.player.components.fingerprints.RemixGenericButtonFingerprint import app.revanced.patches.music.player.components.fingerprints.RepeatTrackFingerprint import app.revanced.patches.music.player.components.fingerprints.ShuffleClassReferenceFingerprint @@ -42,13 +43,16 @@ import app.revanced.patches.music.utils.integrations.Constants.PLAYER_CLASS_DESC import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.AudioVideoSwitchToggle import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.ColorGrey +import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.DarkBackground import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.MiniPlayerPlayPauseReplayButton +import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.TapBloomView import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.TopEnd import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.TopStart import app.revanced.patches.music.utils.settings.CategoryType import app.revanced.patches.music.utils.settings.SettingsPatch import app.revanced.patches.music.utils.videotype.VideoTypeHookPatch import app.revanced.patches.shared.litho.LithoFilterPatch +import app.revanced.util.REGISTER_TEMPLATE_REPLACEMENT import app.revanced.util.getReference import app.revanced.util.getStringInstructionIndex import app.revanced.util.getTargetIndexOrThrow @@ -57,6 +61,7 @@ import app.revanced.util.getTargetIndexWithFieldReferenceTypeOrThrow import app.revanced.util.getWalkerMethod import app.revanced.util.getWideLiteralInstructionIndex import app.revanced.util.literalInstructionBooleanHook +import app.revanced.util.literalInstructionViewHook import app.revanced.util.patch.BaseBytecodePatch import app.revanced.util.resultOrThrow import app.revanced.util.transformFields @@ -106,6 +111,7 @@ object PlayerComponentsPatch : BaseBytecodePatch( OldPlayerLayoutFingerprint, PendingIntentReceiverFingerprint, PlayerPatchConstructorFingerprint, + QuickSeekOverlayFingerprint, RemixGenericButtonFingerprint, RepeatTrackFingerprint, ShuffleClassReferenceFingerprint, @@ -593,6 +599,30 @@ object PlayerComponentsPatch : BaseBytecodePatch( "false" ) + // region patch for hide double-tap overlay filter + + val smaliInstruction = """ + invoke-static {v$REGISTER_TEMPLATE_REPLACEMENT}, $PLAYER_CLASS_DESCRIPTOR->hideDoubleTapOverlayFilter(Landroid/view/View;)V + """ + + arrayOf( + DarkBackground, + TapBloomView + ).forEach { literal -> + QuickSeekOverlayFingerprint.literalInstructionViewHook( + literal, + smaliInstruction + ) + } + + SettingsPatch.addSwitchPreference( + CategoryType.PLAYER, + "revanced_hide_double_tap_overlay_filter", + "false" + ) + + // endregion + // region patch for hide fullscreen share button RemixGenericButtonFingerprint.resultOrThrow().let { diff --git a/src/main/kotlin/app/revanced/patches/music/player/components/fingerprints/QuickSeekOverlayFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/player/components/fingerprints/QuickSeekOverlayFingerprint.kt new file mode 100644 index 000000000..89714d3b2 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/music/player/components/fingerprints/QuickSeekOverlayFingerprint.kt @@ -0,0 +1,15 @@ +package app.revanced.patches.music.player.components.fingerprints + +import app.revanced.patcher.fingerprint.MethodFingerprint +import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.DarkBackground +import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.TapBloomView +import app.revanced.util.containsWideLiteralInstructionIndex + +internal object QuickSeekOverlayFingerprint : MethodFingerprint( + returnType = "V", + parameters = emptyList(), + customFingerprint = { methodDef, _ -> + methodDef.containsWideLiteralInstructionIndex(DarkBackground) + && methodDef.containsWideLiteralInstructionIndex(TapBloomView) + }, +) \ No newline at end of file diff --git a/src/main/resources/music/settings/host/values/strings.xml b/src/main/resources/music/settings/host/values/strings.xml index 476f9607d..1faf21011 100644 --- a/src/main/resources/music/settings/host/values/strings.xml +++ b/src/main/resources/music/settings/host/values/strings.xml @@ -239,6 +239,8 @@ This does not bypass the age restriction. It just accepts it automatically."Hides the channel guidelines at the top of the comments section. Hide timestamp and emoji buttons Hides the timestamp and emoji buttons when typing comments. + Hide double-tap overlay filter + Hides dark overlay that appears when double-tapping to seek. Hide fullscreen Share button Hides the Share button in the fullscreen player. Remember repeat state