mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-21 16:57:18 +02:00
feat(YouTube): Add some compile time patches (#51)
* feat(YouTube - Shorts): Add `Force disable Shorts dim` in the new RVX code * feat(YouTube - Shorts): Add `Hide double tap to like animations` in the new RVX code * feat(YouTube - Shorts): Add `Hide animated button background` in the new RVX code * feat(YouTube - Player): Rename `ForcePlayerButtonBackgroundPatch` * chore: Better patch naming * chore: Use deprecated method to maintain compatibility
This commit is contained in:
parent
84dd65f8a7
commit
60c05cb193
@ -0,0 +1,33 @@
|
||||
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
|
||||
|
||||
@Suppress("unused")
|
||||
object ForceAnimatedButtonBackgroundPatch : ResourcePatch(
|
||||
name = "Force 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,
|
||||
use = false
|
||||
) {
|
||||
override fun execute(context: ResourceContext) {
|
||||
/**
|
||||
* Copy json
|
||||
*/
|
||||
context.copyResources(
|
||||
"youtube/animated",
|
||||
ResourceGroup(
|
||||
"raw",
|
||||
"pause_tap_feedback.json",
|
||||
"play_tap_feedback.json"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("Hide animated button background")
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
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
|
||||
|
||||
|
||||
@Suppress("unused")
|
||||
object ForceAnimatedLikePatch : ResourcePatch(
|
||||
name = "Force 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,
|
||||
use = false
|
||||
) {
|
||||
override fun execute(context: ResourceContext) {
|
||||
/**
|
||||
* Copy json
|
||||
*/
|
||||
context.copyResources(
|
||||
"youtube/animated",
|
||||
ResourceGroup(
|
||||
"raw",
|
||||
"like_tap_feedback.json"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("Hide double tap to like animations")
|
||||
}
|
||||
}
|
@ -7,10 +7,10 @@ import app.revanced.util.doRecursively
|
||||
import app.revanced.util.patch.BaseResourcePatch
|
||||
import org.w3c.dom.Element
|
||||
|
||||
@Suppress("DEPRECATION", "unused")
|
||||
object PlayerButtonBackgroundPatch : BaseResourcePatch(
|
||||
name = "Hide player button background",
|
||||
description = "Hides the dark background surrounding the video player controls.",
|
||||
@Suppress("Deprecation", "unused")
|
||||
object ForcePlayerButtonBackgroundPatch : BaseResourcePatch(
|
||||
name = "Force hide player buttons background",
|
||||
description = "Hide the dark background surrounding the video player controls at compile time.",
|
||||
dependencies = setOf(SettingsPatch::class),
|
||||
compatiblePackages = COMPATIBLE_PACKAGE,
|
||||
use = false
|
||||
|
@ -0,0 +1,43 @@
|
||||
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")
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
{"nm":"empty","ddd":0,"h":500,"w":500,"meta":{"g":"@lottiefiles/creator 1.2.0"},"layers":[],"v":"5.7.0","fr":30,"op":30,"ip":0,"assets":[]}
|
@ -0,0 +1 @@
|
||||
{"v":"5.7.5","fr":100,"ip":0,"op":203.33333333333331,"w":96,"h":96,"nm":"Comp 1","ddd":0,"assets":[{"id":"0","layers":[{"ddd":0,"ind":0,"ty":4,"nm":"Group 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":2},"r":{"a":0,"k":0,"ix":2},"p":{"a":0,"k":[10000,10000],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2}},"ao":0,"hd":false,"shapes":[{"ty":"gr","hd":false,"it":[{"ty":"sh","hd":false,"d":1,"ks":{"a":0,"k":{"c":false,"v":[[-1,-9],[1,-9],[2,-8],[2,8],[1,9],[-1,9],[-2,8],[-2,-8],[-1,-9]],"i":[[-0.553,0],[0,0],[0,-0.552],[0,0],[0.553,0],[0,0],[0,0.553],[0,0],[-0.553,0]],"o":[[0,0],[0.553,0],[0,0],[0,0.553],[0,0],[-0.553,0],[0,0],[0,-0.552],[0,0]]}}},{"ty":"fl","c":{"a":0,"k":[1,1,1],"ix":2},"o":{"a":0,"k":100,"ix":2},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tm","s":{"a":0,"k":0,"ix":2},"e":{"a":0,"k":100,"ix":2},"o":{"a":0,"k":0,"ix":2},"m":1,"hd":false},{"ty":"tr","hd":false,"p":{"a":0,"k":[21,16],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2},"r":{"a":0,"k":0,"ix":2},"o":{"a":0,"k":100,"ix":2},"sk":{"a":0,"k":0,"ix":2},"sa":{"a":0,"k":0,"ix":2}}]}],"ip":0,"op":203.33333333333331,"st":0,"bm":0},{"ddd":0,"ind":1,"ty":4,"nm":"Group 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":2},"r":{"a":0,"k":0,"ix":2},"p":{"a":0,"k":[10000,10000],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2}},"ao":0,"hd":false,"shapes":[{"ty":"gr","hd":false,"it":[{"ty":"sh","hd":false,"d":1,"ks":{"a":0,"k":{"c":false,"v":[[-1,-9],[1,-9],[2,-8],[2,8],[1,9],[-1,9],[-2,8],[-2,-8],[-1,-9]],"i":[[-0.552,0],[0,0],[0,-0.552],[0,0],[0.552,0],[0,0],[0,0.553],[0,0],[-0.552,0]],"o":[[0,0],[0.552,0],[0,0],[0,0.553],[0,0],[-0.552,0],[0,0],[0,-0.552],[0,0]]}}},{"ty":"fl","c":{"a":0,"k":[1,1,1],"ix":2},"o":{"a":0,"k":100,"ix":2},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tm","s":{"a":0,"k":0,"ix":2},"e":{"a":0,"k":100,"ix":2},"o":{"a":0,"k":0,"ix":2},"m":1,"hd":false},{"ty":"tr","hd":false,"p":{"a":0,"k":[11,16],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2},"r":{"a":0,"k":0,"ix":2},"o":{"a":0,"k":100,"ix":2},"sk":{"a":0,"k":0,"ix":2},"sa":{"a":0,"k":0,"ix":2}}]}],"ip":0,"op":203.33333333333331,"st":0,"bm":0}]}],"layers":[{"ddd":0,"refId":"0","w":20000,"h":20000,"ind":2,"ty":0,"nm":"pause Outlines","sr":1,"ks":{"o":{"a":1,"k":[{"t":83,"s":[100],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":100,"s":[0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}}],"ix":2},"r":{"a":0,"k":0,"ix":2},"p":{"a":0,"k":[48,48],"ix":2},"a":{"a":0,"k":[10016,10016],"ix":2},"s":{"a":1,"k":[{"t":0,"s":[0,0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":13,"s":[130,130],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":43,"s":[100,100],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":83,"s":[100,100],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":120,"s":[0,0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}}],"ix":2}},"ao":0,"ip":0,"op":203.33333333333331,"st":0,"bm":0,"hd":false},{"ddd":0,"ind":3,"ty":4,"nm":"Ellipse Path 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":2},"r":{"a":0,"k":0,"ix":2},"p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2}},"ao":0,"hd":false,"shapes":[{"ty":"gr","hd":false,"it":[{"ty":"el","hd":false,"d":1,"s":{"a":0,"k":[72,72],"ix":2},"p":{"a":0,"k":[0,0],"ix":2}},{"ty":"st","c":{"a":0,"k":[1,1,1],"ix":2},"o":{"a":0,"k":100,"ix":2},"w":{"a":0,"k":0,"ix":2},"hd":false,"lc":2,"lj":2},{"ty":"fl","c":{"a":0,"k":[0,0,0],"ix":2},"o":{"a":1,"k":[{"t":0,"s":[60],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":2,"s":[0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":10,"s":[0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":13,"s":[0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":40,"s":[0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}}],"ix":2},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tm","s":{"a":0,"k":0,"ix":2},"e":{"a":0,"k":100,"ix":2},"o":{"a":0,"k":0,"ix":2},"m":1,"hd":false},{"ty":"tr","hd":false,"p":{"a":0,"k":[48,48],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":1,"k":[{"t":0,"s":[0,0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":13,"s":[110.00000000000001,110.00000000000001],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":43,"s":[100,100],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":83,"s":[100,100],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":120,"s":[0,0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}}],"ix":2},"r":{"a":0,"k":0,"ix":2},"o":{"a":1,"k":[{"t":83,"s":[100],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":100,"s":[0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}}],"ix":2},"sk":{"a":0,"k":0,"ix":2},"sa":{"a":0,"k":0,"ix":2}}]}],"ip":0,"op":203.33333333333331,"st":0,"bm":0}],"markers":[]}
|
@ -0,0 +1 @@
|
||||
{"v":"5.7.5","fr":100,"ip":0,"op":203.33333333333331,"w":96,"h":96,"nm":"Comp 1","ddd":0,"assets":[{"id":"0","layers":[{"ddd":0,"ind":0,"ty":4,"nm":"Group 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":2},"r":{"a":0,"k":0,"ix":2},"p":{"a":0,"k":[10000,10000],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2}},"ao":0,"hd":false,"shapes":[{"ty":"gr","hd":false,"it":[{"ty":"sh","hd":false,"d":1,"ks":{"a":0,"k":{"c":false,"v":[[-9.5,-9.266],[-7.999,-10.13],[9.5,0.001],[-7.999,10.13],[-9.5,9.266],[-9.5,-9.266]],"i":[[0,0],[-0.667,-0.386],[0,0],[0,0],[0,0.771],[0,0]],"o":[[0,-0.77],[0,0],[0,0],[-0.667,0.386],[0,0],[0,-0.77]]}}},{"ty":"fl","c":{"a":0,"k":[1,1,1],"ix":2},"o":{"a":0,"k":100,"ix":2},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tm","s":{"a":0,"k":0,"ix":2},"e":{"a":0,"k":100,"ix":2},"o":{"a":0,"k":0,"ix":2},"m":1,"hd":false},{"ty":"tr","hd":false,"p":{"a":0,"k":[17.5,16],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2},"r":{"a":0,"k":0,"ix":2},"o":{"a":0,"k":100,"ix":2},"sk":{"a":0,"k":0,"ix":2},"sa":{"a":0,"k":0,"ix":2}}]}],"ip":0,"op":203.33333333333331,"st":0,"bm":0}]}],"layers":[{"ddd":0,"refId":"0","w":20000,"h":20000,"ind":1,"ty":0,"nm":"play Outlines","sr":1,"ks":{"o":{"a":1,"k":[{"t":57,"s":[100],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":73,"s":[0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}}],"ix":2},"r":{"a":0,"k":0,"ix":2},"p":{"a":0,"k":[48,48],"ix":2},"a":{"a":0,"k":[10016,10016],"ix":2},"s":{"a":1,"k":[{"t":0,"s":[0,0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":13,"s":[130,130],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":43,"s":[100,100],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":57,"s":[100,100],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":93,"s":[0,0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}}],"ix":2}},"ao":0,"ip":0,"op":203.33333333333331,"st":0,"bm":0,"hd":false},{"ddd":0,"ind":2,"ty":4,"nm":"Ellipse Path 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":2},"r":{"a":0,"k":0,"ix":2},"p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2}},"ao":0,"hd":false,"shapes":[{"ty":"gr","hd":false,"it":[{"ty":"el","hd":false,"d":1,"s":{"a":0,"k":[72,72],"ix":2},"p":{"a":0,"k":[0,0],"ix":2}},{"ty":"st","c":{"a":0,"k":[1,1,1],"ix":2},"o":{"a":0,"k":100,"ix":2},"w":{"a":0,"k":0,"ix":2},"hd":false,"lc":2,"lj":2},{"ty":"fl","c":{"a":0,"k":[0,0,0],"ix":2},"o":{"a":1,"k":[{"t":0,"s":[0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":5,"s":[0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":11,"s":[0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":38,"s":[0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}}],"ix":2},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tm","s":{"a":0,"k":0,"ix":2},"e":{"a":0,"k":100,"ix":2},"o":{"a":0,"k":0,"ix":2},"m":1,"hd":false},{"ty":"tr","hd":false,"p":{"a":0,"k":[48,48],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":1,"k":[{"t":0,"s":[0,0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":11,"s":[110.00000000000001,110.00000000000001],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":41,"s":[100,100],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":57,"s":[100,100],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":93,"s":[0,0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}}],"ix":2},"r":{"a":0,"k":0,"ix":2},"o":{"a":1,"k":[{"t":57,"s":[100],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}},{"t":73,"s":[0],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}}],"ix":2},"sk":{"a":0,"k":0,"ix":2},"sa":{"a":0,"k":0,"ix":2}}]}],"ip":0,"op":203.33333333333331,"st":0,"bm":0}],"markers":[]}
|
@ -650,8 +650,10 @@
|
||||
|
||||
<PreferenceCategory android:title="@string/revanced_preference_category_others" android:layout="@layout/revanced_settings_preferences_category">
|
||||
<Preference android:title="Custom double tap length" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="Hide animated button background" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="GmsCore support" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="Hide double tap overlay filter" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="Hide double tap to like animations" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="Icon" android:summary="@string/revanced_icon_default" android:selectable="false"/>
|
||||
<Preference android:title="Label" android:summary="@string/revanced_label_default" android:selectable="false"/>
|
||||
<Preference android:title="Return YouTube Dislike" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user