Skip to content

Commit 5271610

Browse files
committed
feat(YouTube - Hide player buttons baclground): Add a switch setting Hide player buttons background
1 parent b7d50ec commit 5271610

File tree

4 files changed

+109
-2
lines changed

4 files changed

+109
-2
lines changed

api/revanced-patches.api

+12-2
Original file line numberDiff line numberDiff line change
@@ -2554,12 +2554,22 @@ public final class app/revanced/patches/youtube/player/musicbutton/fingerprints/
25542554
public static final field INSTANCE Lapp/revanced/patches/youtube/player/musicbutton/fingerprints/MusicAppDeeplinkButtonFingerprint;
25552555
}
25562556

2557-
public final class app/revanced/patches/youtube/player/playerbuttonbg/HidePlayerButtonBackgroundPatch : app/revanced/patcher/patch/ResourcePatch {
2558-
public static final field INSTANCE Lapp/revanced/patches/youtube/player/playerbuttonbg/HidePlayerButtonBackgroundPatch;
2557+
public final class app/revanced/patches/youtube/player/playerbuttonbg/ForceHidePlayerButtonBackgroundPatch : app/revanced/patcher/patch/ResourcePatch {
2558+
public static final field INSTANCE Lapp/revanced/patches/youtube/player/playerbuttonbg/ForceHidePlayerButtonBackgroundPatch;
25592559
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
25602560
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
25612561
}
25622562

2563+
public final class app/revanced/patches/youtube/player/playerbuttonbg/HidePlayerButtonBackgroundPatch : app/revanced/patcher/patch/BytecodePatch {
2564+
public static final field INSTANCE Lapp/revanced/patches/youtube/player/playerbuttonbg/HidePlayerButtonBackgroundPatch;
2565+
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
2566+
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
2567+
}
2568+
2569+
public final class app/revanced/patches/youtube/player/playerbuttonbg/fingerprints/PlayerPatchFingerprint : app/revanced/patcher/fingerprint/MethodFingerprint {
2570+
public static final field INSTANCE Lapp/revanced/patches/youtube/player/playerbuttonbg/fingerprints/PlayerPatchFingerprint;
2571+
}
2572+
25632573
public final class app/revanced/patches/youtube/player/playeroverlay/CustomPlayerOverlayOpacityPatch : app/revanced/patcher/patch/BytecodePatch {
25642574
public static final field INSTANCE Lapp/revanced/patches/youtube/player/playeroverlay/CustomPlayerOverlayOpacityPatch;
25652575
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
package app.revanced.patches.youtube.player.playerbuttonbg
2+
3+
import app.revanced.patcher.data.BytecodeContext
4+
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
5+
import app.revanced.patcher.patch.BytecodePatch
6+
import app.revanced.patcher.patch.annotation.CompatiblePackage
7+
import app.revanced.patcher.patch.annotation.Patch
8+
import app.revanced.patches.youtube.player.playerbuttonbg.fingerprints.PlayerPatchFingerprint
9+
import app.revanced.patches.youtube.utils.integrations.Constants.INTEGRATIONS_PATH
10+
import app.revanced.patches.youtube.utils.playerbutton.PlayerButtonHookPatch
11+
import app.revanced.patches.youtube.utils.settings.SettingsPatch
12+
import app.revanced.util.exception
13+
14+
@Patch(
15+
name = "Hide player buttons background",
16+
description = "Adds an option to hide player buttons background. Exclude \"Force hide player buttons background\".",
17+
dependencies = [
18+
PlayerButtonHookPatch::class,
19+
SettingsPatch::class
20+
],
21+
compatiblePackages = [
22+
CompatiblePackage(
23+
"com.google.android.youtube",
24+
[
25+
"18.25.40",
26+
"18.27.36",
27+
"18.29.38",
28+
"18.30.37",
29+
"18.31.40",
30+
"18.32.39",
31+
"18.33.40",
32+
"18.34.38",
33+
"18.35.36",
34+
"18.36.39",
35+
"18.37.36",
36+
"18.38.44",
37+
"18.39.41",
38+
"18.40.34",
39+
"18.41.39",
40+
"18.42.41",
41+
"18.43.45",
42+
"18.44.41",
43+
"18.45.43",
44+
"18.46.45",
45+
"18.48.39",
46+
"18.49.37",
47+
"19.01.34",
48+
"19.02.39",
49+
"19.03.36",
50+
"19.04.38",
51+
"19.05.35",
52+
"19.05.36"
53+
]
54+
)
55+
],
56+
use = false
57+
)
58+
@Suppress("unused")
59+
object HidePlayerButtonBackgroundPatch : BytecodePatch(
60+
setOf(PlayerPatchFingerprint)
61+
) {
62+
override fun execute(context: BytecodeContext) {
63+
64+
PlayerPatchFingerprint.result?.mutableMethod?.addInstruction(
65+
0,
66+
"invoke-static {p0}, " +
67+
"$INTEGRATIONS_PATH/utils/ResourceHelper;->" +
68+
"hidePlayerButtonBackground(Landroid/view/View;)V"
69+
) ?: throw PlayerPatchFingerprint.exception
70+
71+
/**
72+
* Add settings
73+
*/
74+
SettingsPatch.addPreference(
75+
arrayOf(
76+
"PREFERENCE: PLAYER_SETTINGS",
77+
"SETTINGS: HIDE_PLAYER_BUTTON_BACKGROUND"
78+
)
79+
)
80+
81+
SettingsPatch.updatePatchStatus("Hide player buttons background")
82+
83+
}
84+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package app.revanced.patches.youtube.player.playerbuttonbg.fingerprints
2+
3+
import app.revanced.patcher.fingerprint.MethodFingerprint
4+
5+
object PlayerPatchFingerprint : MethodFingerprint(
6+
customFingerprint = { methodDef, _ ->
7+
methodDef.definingClass == "Lapp/revanced/integrations/youtube/patches/player/PlayerPatch;"
8+
&& methodDef.name == "hidePlayerButton"
9+
}
10+
)

src/main/resources/youtube/settings/host/values/strings.xml

+3
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,9 @@ Some components may not be hidden."</string>
539539
<string name="revanced_hide_place_section_summary_off">Place sections are shown.</string>
540540
<string name="revanced_hide_place_section_summary_on">Place sections are hidden.</string>
541541
<string name="revanced_hide_place_section_title">Hide place sections</string>
542+
<string name="revanced_hide_player_button_background_summary_off">Player buttons background is shown.</string>
543+
<string name="revanced_hide_player_button_background_summary_on">Player buttons background is hidden.</string>
544+
<string name="revanced_hide_player_button_background_title">Hide player buttons background</string>
542545
<string name="revanced_hide_player_flyout_panel_ambient_mode_summary_off">Ambient mode menu is shown.</string>
543546
<string name="revanced_hide_player_flyout_panel_ambient_mode_summary_on">Ambient mode menu is hidden.</string>
544547
<string name="revanced_hide_player_flyout_panel_ambient_mode_title">Hide ambient mode menu</string>

0 commit comments

Comments
 (0)