diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/animated/ForceAnimatedButtonBackgroundPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/animated/AnimatedButtonBackgroundPatch.kt similarity index 79% rename from src/main/kotlin/app/revanced/patches/youtube/layout/animated/ForceAnimatedButtonBackgroundPatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/animated/AnimatedButtonBackgroundPatch.kt index ee89033e5..1196232a8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/animated/ForceAnimatedButtonBackgroundPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/animated/AnimatedButtonBackgroundPatch.kt @@ -1,15 +1,15 @@ package app.revanced.patches.youtube.layout.animated import app.revanced.patcher.data.ResourceContext -import app.revanced.patcher.patch.ResourcePatch import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE import app.revanced.patches.youtube.utils.settings.SettingsPatch -import app.revanced.util.copyResources import app.revanced.util.ResourceGroup +import app.revanced.util.copyResources +import app.revanced.util.patch.BaseResourcePatch @Suppress("unused") -object ForceAnimatedButtonBackgroundPatch : ResourcePatch( - name = "Force hide animated button background", +object AnimatedButtonBackgroundPatch : BaseResourcePatch( + name = "Hide animated button background", description = "Hides the background of the pause and play animated buttons in the Shorts player at compile time.", dependencies = setOf(SettingsPatch::class), compatiblePackages = COMPATIBLE_PACKAGE, @@ -28,6 +28,6 @@ object ForceAnimatedButtonBackgroundPatch : ResourcePatch( ) ) - SettingsPatch.updatePatchStatus("Hide animated button background") + SettingsPatch.updatePatchStatus(this) } } \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/animated/ForceAnimatedLikePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/animated/AnimatedLikePatch.kt similarity index 79% rename from src/main/kotlin/app/revanced/patches/youtube/layout/animated/ForceAnimatedLikePatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/animated/AnimatedLikePatch.kt index b74ad95d8..e1f9b3cba 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/animated/ForceAnimatedLikePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/animated/AnimatedLikePatch.kt @@ -1,16 +1,16 @@ package app.revanced.patches.youtube.layout.animated import app.revanced.patcher.data.ResourceContext -import app.revanced.patcher.patch.ResourcePatch import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE import app.revanced.patches.youtube.utils.settings.SettingsPatch import app.revanced.util.ResourceGroup import app.revanced.util.copyResources +import app.revanced.util.patch.BaseResourcePatch @Suppress("unused") -object ForceAnimatedLikePatch : ResourcePatch( - name = "Force hide double tap to like animations", +object AnimatedLikePatch : BaseResourcePatch( + name = "Hide double tap to like animations", description = "Hide the like animations when double tap the screen in the Shorts player at compile time.", dependencies = setOf(SettingsPatch::class), compatiblePackages = COMPATIBLE_PACKAGE, @@ -28,6 +28,6 @@ object ForceAnimatedLikePatch : ResourcePatch( ) ) - SettingsPatch.updatePatchStatus("Hide double tap to like animations") + SettingsPatch.updatePatchStatus(this) } } \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/dimming/ShortsDimmingPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/dimming/ShortsDimmingPatch.kt new file mode 100644 index 000000000..46d8258ca --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/dimming/ShortsDimmingPatch.kt @@ -0,0 +1,30 @@ +package app.revanced.patches.youtube.layout.dimming + +import app.revanced.patcher.data.ResourceContext +import app.revanced.patches.shared.overlaybackground.OverlayBackgroundUtils.removeOverlayBackground +import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE +import app.revanced.patches.youtube.utils.settings.SettingsPatch +import app.revanced.util.patch.BaseResourcePatch + +@Suppress("unused") +object ShortsDimmingPatch : BaseResourcePatch( + name = "Hide shorts dimming", + description = "Hide the dimming effect on the top and bottom of Shorts video at compile time.", + dependencies = setOf(SettingsPatch::class), + compatiblePackages = COMPATIBLE_PACKAGE, + use = false +) { + override fun execute(context: ResourceContext) { + + context.removeOverlayBackground( + arrayOf("reel_player_overlay_scrims.xml"), + arrayOf("reel_player_overlay_v2_scrims_vertical") + ) + context.removeOverlayBackground( + arrayOf("reel_watch_fragment.xml"), + arrayOf("reel_scrim_shorts_while_top") + ) + + SettingsPatch.updatePatchStatus(this) + } +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/dimming/ForceDisableShortsDimPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/dimming/ForceDisableShortsDimPatch.kt deleted file mode 100644 index 5f783ab8a..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/dimming/ForceDisableShortsDimPatch.kt +++ /dev/null @@ -1,43 +0,0 @@ -package app.revanced.patches.youtube.shorts.dimming - -import app.revanced.patcher.data.ResourceContext -import app.revanced.patcher.patch.ResourcePatch -import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE -import app.revanced.patches.youtube.utils.settings.SettingsPatch -import app.revanced.util.doRecursively -import org.w3c.dom.Element - -@Suppress("Deprecation", "unused") -object ForceDisableShortsDimPatch : ResourcePatch( - name = "Force disable Shorts dim", - description = "Hide the dimming effect on the top and bottom of Shorts video at compile time.", - dependencies = setOf(SettingsPatch::class), - compatiblePackages = COMPATIBLE_PACKAGE, - use = false -) { - override fun execute(context: ResourceContext) { - val hide = "0.0dip" - - fun hideLayoutAttributes(layoutFile: String, targetId: String) { - context.xmlEditor[layoutFile].use { editor -> - editor.file.doRecursively { node -> - if (node !is Element) return@doRecursively - - when (node.getAttributeNode("android:id")?.textContent) { - targetId -> { - node.apply { - setAttribute("android:layout_height", hide) - setAttribute("android:layout_width", hide) - } - } - } - } - } - } - - hideLayoutAttributes("res/layout/reel_player_overlay_scrims.xml", "@id/reel_player_overlay_v2_scrims_vertical") - hideLayoutAttributes("res/layout/reel_watch_fragment.xml", "@id/reel_scrim_shorts_while_top") - - SettingsPatch.updatePatchStatus("Force disable Shorts dim") - } -} diff --git a/src/main/resources/youtube/settings/xml/revanced_prefs.xml b/src/main/resources/youtube/settings/xml/revanced_prefs.xml index 75a4f662f..62bd0b9a4 100644 --- a/src/main/resources/youtube/settings/xml/revanced_prefs.xml +++ b/src/main/resources/youtube/settings/xml/revanced_prefs.xml @@ -644,10 +644,11 @@ - + +