mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-13 05:37:40 +02:00
add hide-live-chat-button
, hide-next-button
, hide-prev-button
patches (player controller)
This commit is contained in:
@ -0,0 +1,49 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.player.livechatbutton.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.ResourceContext
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
|
import app.revanced.shared.annotation.YouTubeCompatibility
|
||||||
|
import app.revanced.shared.patches.playerbutton.PlayerButtonPatch
|
||||||
|
import app.revanced.shared.util.resources.ResourceHelper
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("hide-live-chat-button")
|
||||||
|
@Description("Hides the live chat button in the video player.")
|
||||||
|
@DependsOn(
|
||||||
|
[
|
||||||
|
PlayerButtonPatch::class,
|
||||||
|
SettingsPatch::class
|
||||||
|
]
|
||||||
|
)
|
||||||
|
@YouTubeCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class HideLiveChatButtonPatch : ResourcePatch {
|
||||||
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
|
||||||
|
/*
|
||||||
|
add settings
|
||||||
|
*/
|
||||||
|
ResourceHelper.addSettings2(
|
||||||
|
context,
|
||||||
|
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
|
||||||
|
"PREFERENCE: LAYOUT_SETTINGS",
|
||||||
|
"PREFERENCE_HEADER: PLAYER",
|
||||||
|
"SETTINGS: HIDE_LIVE_CHAT_BUTTON"
|
||||||
|
)
|
||||||
|
|
||||||
|
ResourceHelper.patchSuccess(
|
||||||
|
context,
|
||||||
|
"hide-live-chat-button"
|
||||||
|
)
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.player.nextprevbutton.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.ResourceContext
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
|
import app.revanced.shared.annotation.YouTubeCompatibility
|
||||||
|
import app.revanced.shared.patches.playerbutton.PlayerButtonPatch
|
||||||
|
import app.revanced.shared.util.resources.ResourceHelper
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("hide-next-prev-button")
|
||||||
|
@Description("Hides the next prev button in the player controller.")
|
||||||
|
@DependsOn(
|
||||||
|
[
|
||||||
|
PlayerButtonPatch::class,
|
||||||
|
SettingsPatch::class
|
||||||
|
]
|
||||||
|
)
|
||||||
|
@YouTubeCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class HideNextPrevButtonPatch : ResourcePatch {
|
||||||
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
|
||||||
|
/*
|
||||||
|
add settings
|
||||||
|
*/
|
||||||
|
ResourceHelper.addSettings3(
|
||||||
|
context,
|
||||||
|
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
|
||||||
|
"PREFERENCE: LAYOUT_SETTINGS",
|
||||||
|
"PREFERENCE_HEADER: PLAYER",
|
||||||
|
"SETTINGS: HIDE_NEXT_BUTTON",
|
||||||
|
"SETTINGS: HIDE_PREV_BUTTON"
|
||||||
|
)
|
||||||
|
|
||||||
|
ResourceHelper.patchSuccess(
|
||||||
|
context,
|
||||||
|
"hide-next-prev-button"
|
||||||
|
)
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
@ -32,6 +32,7 @@ class SharedResourcdIdPatch : ResourcePatch {
|
|||||||
var layoutCircle: Long = -1
|
var layoutCircle: Long = -1
|
||||||
var layoutIcon: Long = -1
|
var layoutIcon: Long = -1
|
||||||
var layoutVideo: Long = -1
|
var layoutVideo: Long = -1
|
||||||
|
var liveChatButtonId: Long = -1
|
||||||
var scrubbingLabelId: Long = -1
|
var scrubbingLabelId: Long = -1
|
||||||
var timebarColorLabelId: Long = -1
|
var timebarColorLabelId: Long = -1
|
||||||
var videoqualityfragmentLabelId: Long = -1
|
var videoqualityfragmentLabelId: Long = -1
|
||||||
@ -59,6 +60,7 @@ class SharedResourcdIdPatch : ResourcePatch {
|
|||||||
layoutCircle = findSharedResourceId("layout", "endscreen_element_layout_circle")
|
layoutCircle = findSharedResourceId("layout", "endscreen_element_layout_circle")
|
||||||
layoutIcon = findSharedResourceId("layout", "endscreen_element_layout_icon")
|
layoutIcon = findSharedResourceId("layout", "endscreen_element_layout_icon")
|
||||||
layoutVideo = findSharedResourceId("layout", "endscreen_element_layout_video")
|
layoutVideo = findSharedResourceId("layout", "endscreen_element_layout_video")
|
||||||
|
liveChatButtonId = findSharedResourceId("id", "live_chat_overlay_button")
|
||||||
scrubbingLabelId = findSharedResourceId("dimen", "vertical_touch_offset_to_enter_fine_scrubbing")
|
scrubbingLabelId = findSharedResourceId("dimen", "vertical_touch_offset_to_enter_fine_scrubbing")
|
||||||
timebarColorLabelId = findSharedResourceId("color", "inline_time_bar_progress_color")
|
timebarColorLabelId = findSharedResourceId("color", "inline_time_bar_progress_color")
|
||||||
videoqualityfragmentLabelId = findSharedResourceId("layout", "video_quality_bottom_sheet_list_fragment_title")
|
videoqualityfragmentLabelId = findSharedResourceId("layout", "video_quality_bottom_sheet_list_fragment_title")
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
package app.revanced.shared.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
|
||||||
|
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object LiveChatFingerprint : MethodFingerprint(
|
||||||
|
opcodes = listOf(Opcode.NEW_INSTANCE),
|
||||||
|
customFingerprint = { methodDef ->
|
||||||
|
methodDef.implementation?.instructions?.any {
|
||||||
|
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
||||||
|
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.liveChatButtonId
|
||||||
|
} == true
|
||||||
|
}
|
||||||
|
)
|
@ -0,0 +1,74 @@
|
|||||||
|
package app.revanced.shared.patches.playerbutton
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
|
||||||
|
import app.revanced.shared.annotation.YouTubeCompatibility
|
||||||
|
import app.revanced.shared.extensions.findMutableMethodOf
|
||||||
|
import app.revanced.shared.extensions.toErrorResult
|
||||||
|
import app.revanced.shared.fingerprints.LiveChatFingerprint
|
||||||
|
import app.revanced.shared.util.integrations.Constants.PLAYER_LAYOUT
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
import org.jf.dexlib2.builder.instruction.BuilderInstruction21c
|
||||||
|
import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
|
||||||
|
|
||||||
|
@Name("hook-player-button-patch")
|
||||||
|
@DependsOn([SharedResourcdIdPatch::class])
|
||||||
|
@YouTubeCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class PlayerButtonPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
LiveChatFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
|
LiveChatFingerprint.result?.let {
|
||||||
|
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
val instuctions = it.mutableMethod.instruction(endIndex)
|
||||||
|
val imageButtonClass =
|
||||||
|
context
|
||||||
|
.findClass((instuctions as BuilderInstruction21c)
|
||||||
|
.reference.toString())!!
|
||||||
|
.mutableClass
|
||||||
|
|
||||||
|
for (method in imageButtonClass.methods) {
|
||||||
|
with (imageButtonClass.findMutableMethodOf(method)) {
|
||||||
|
var jumpInstruction = true
|
||||||
|
|
||||||
|
implementation!!.instructions.forEachIndexed { index, instuctions ->
|
||||||
|
if (instuctions.opcode.ordinal == Opcode.INVOKE_VIRTUAL.ordinal) {
|
||||||
|
val definedInstruction = (instuctions as? BuilderInstruction35c)
|
||||||
|
|
||||||
|
if (definedInstruction?.reference.toString() ==
|
||||||
|
"Landroid/view/View;->setVisibility(I)V") {
|
||||||
|
|
||||||
|
jumpInstruction = !jumpInstruction
|
||||||
|
if (jumpInstruction) return@forEachIndexed
|
||||||
|
|
||||||
|
val firstRegister = definedInstruction?.registerC
|
||||||
|
val secondRegister = definedInstruction?.registerD
|
||||||
|
|
||||||
|
addInstructions(
|
||||||
|
index, """
|
||||||
|
invoke-static {v$firstRegister, v$secondRegister}, $PLAYER_LAYOUT->hidePlayerButton(Landroid/view/View;I)I
|
||||||
|
move-result v$secondRegister
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} ?: return LiveChatFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
@ -339,6 +339,9 @@ Is it ready to submit?"</string>
|
|||||||
<string name="revanced_hide_info_cards_summary_off">Info cards are shown</string>
|
<string name="revanced_hide_info_cards_summary_off">Info cards are shown</string>
|
||||||
<string name="revanced_hide_info_cards_summary_on">Info cards are hidden</string>
|
<string name="revanced_hide_info_cards_summary_on">Info cards are hidden</string>
|
||||||
<string name="revanced_hide_info_cards_title">Hide info cards</string>
|
<string name="revanced_hide_info_cards_title">Hide info cards</string>
|
||||||
|
<string name="revanced_hide_live_chat_button_summary_off">Live chat button is shown</string>
|
||||||
|
<string name="revanced_hide_live_chat_button_summary_on">Live chat button is hidden</string>
|
||||||
|
<string name="revanced_hide_live_chat_button_title">Hide live chat button</string>
|
||||||
<string name="revanced_hide_menu_ambient_mode_summary_off">Ambient mode menu is shown</string>
|
<string name="revanced_hide_menu_ambient_mode_summary_off">Ambient mode menu is shown</string>
|
||||||
<string name="revanced_hide_menu_ambient_mode_summary_on">Ambient mode menu is hidden</string>
|
<string name="revanced_hide_menu_ambient_mode_summary_on">Ambient mode menu is hidden</string>
|
||||||
<string name="revanced_hide_menu_ambient_mode_title">Hide ambient mode menu</string>
|
<string name="revanced_hide_menu_ambient_mode_title">Hide ambient mode menu</string>
|
||||||
@ -375,9 +378,15 @@ Is it ready to submit?"</string>
|
|||||||
<string name="revanced_hide_mix_playlists_summary_off">Mix playlist is shown</string>
|
<string name="revanced_hide_mix_playlists_summary_off">Mix playlist is shown</string>
|
||||||
<string name="revanced_hide_mix_playlists_summary_on">Mix playlist is hidden</string>
|
<string name="revanced_hide_mix_playlists_summary_on">Mix playlist is hidden</string>
|
||||||
<string name="revanced_hide_mix_playlists_title">Hide mix playlist</string>
|
<string name="revanced_hide_mix_playlists_title">Hide mix playlist</string>
|
||||||
|
<string name="revanced_hide_next_button_summary_off">Next button is shown</string>
|
||||||
|
<string name="revanced_hide_next_button_summary_on">Next button is hidden</string>
|
||||||
|
<string name="revanced_hide_next_button_title">Hide next button</string>
|
||||||
<string name="revanced_hide_player_overlay_filter_summary_off">Player overlay filter is shown</string>
|
<string name="revanced_hide_player_overlay_filter_summary_off">Player overlay filter is shown</string>
|
||||||
<string name="revanced_hide_player_overlay_filter_summary_on">Player overlay filter is hidden</string>
|
<string name="revanced_hide_player_overlay_filter_summary_on">Player overlay filter is hidden</string>
|
||||||
<string name="revanced_hide_player_overlay_filter_title">Hide player overlay filter</string>
|
<string name="revanced_hide_player_overlay_filter_title">Hide player overlay filter</string>
|
||||||
|
<string name="revanced_hide_prev_button_summary_off">Prev button is shown</string>
|
||||||
|
<string name="revanced_hide_prev_button_summary_on">Prev button is hidden</string>
|
||||||
|
<string name="revanced_hide_prev_button_title">Hide prev button</string>
|
||||||
<string name="revanced_hide_preview_comment_off">Preview comment is shown</string>
|
<string name="revanced_hide_preview_comment_off">Preview comment is shown</string>
|
||||||
<string name="revanced_hide_preview_comment_on">Preview comment is hidden</string>
|
<string name="revanced_hide_preview_comment_on">Preview comment is hidden</string>
|
||||||
<string name="revanced_hide_preview_comment_title">Hide preview comment</string>
|
<string name="revanced_hide_preview_comment_title">Hide preview comment</string>
|
||||||
|
@ -157,6 +157,15 @@
|
|||||||
<!-- SETTINGS: HIDE_CAPTIONS_BUTTON
|
<!-- SETTINGS: HIDE_CAPTIONS_BUTTON
|
||||||
<SwitchPreference android:title="@string/revanced_hide_captions_button_title" android:key="revanced_hide_captions_button" android:defaultValue="false" android:summaryOn="@string/revanced_hide_captions_button_summary_on" android:summaryOff="@string/revanced_hide_captions_button_summary_off" />SETTINGS: HIDE_CAPTIONS_BUTTON -->
|
<SwitchPreference android:title="@string/revanced_hide_captions_button_title" android:key="revanced_hide_captions_button" android:defaultValue="false" android:summaryOn="@string/revanced_hide_captions_button_summary_on" android:summaryOff="@string/revanced_hide_captions_button_summary_off" />SETTINGS: HIDE_CAPTIONS_BUTTON -->
|
||||||
|
|
||||||
|
<!-- SETTINGS: HIDE_LIVE_CHAT_BUTTON
|
||||||
|
<SwitchPreference android:title="@string/revanced_hide_live_chat_button_title" android:key="revanced_hide_live_chat_button" android:defaultValue="false" android:summaryOn="@string/revanced_hide_live_chat_button_summary_on" android:summaryOff="@string/revanced_hide_live_chat_button_summary_off" />SETTINGS: HIDE_LIVE_CHAT_BUTTON -->
|
||||||
|
|
||||||
|
<!-- SETTINGS: HIDE_NEXT_BUTTON
|
||||||
|
<SwitchPreference android:title="@string/revanced_hide_next_button_title" android:key="revanced_hide_next_button" android:defaultValue="false" android:summaryOn="@string/revanced_hide_next_button_summary_on" android:summaryOff="@string/revanced_hide_next_button_summary_off" />SETTINGS: HIDE_NEXT_BUTTON -->
|
||||||
|
|
||||||
|
<!-- SETTINGS: HIDE_PREV_BUTTON
|
||||||
|
<SwitchPreference android:title="@string/revanced_hide_prev_button_title" android:key="revanced_hide_prev_button" android:defaultValue="false" android:summaryOn="@string/revanced_hide_prev_button_summary_on" android:summaryOff="@string/revanced_hide_prev_button_summary_off" />SETTINGS: HIDE_PREV_BUTTON -->
|
||||||
|
|
||||||
<!-- SETTINGS: HIDE_ENDSCREEN_CARDS
|
<!-- SETTINGS: HIDE_ENDSCREEN_CARDS
|
||||||
<SwitchPreference android:title="@string/revanced_hide_endscreen_cards_title" android:key="revanced_hide_endscreen_cards" android:defaultValue="true" android:summaryOn="@string/revanced_hide_endscreen_cards_summary_on" android:summaryOff="@string/revanced_hide_endscreen_cards_summary_off" />SETTINGS: HIDE_ENDSCREEN_CARDS -->
|
<SwitchPreference android:title="@string/revanced_hide_endscreen_cards_title" android:key="revanced_hide_endscreen_cards" android:defaultValue="true" android:summaryOn="@string/revanced_hide_endscreen_cards_summary_on" android:summaryOff="@string/revanced_hide_endscreen_cards_summary_off" />SETTINGS: HIDE_ENDSCREEN_CARDS -->
|
||||||
|
|
||||||
@ -374,6 +383,8 @@
|
|||||||
<Preference android:title="hide-cast-button" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="hide-cast-button" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="hide-autoplay-button" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="hide-autoplay-button" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="hide-captions-button" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="hide-captions-button" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
|
<Preference android:title="hide-live-chat-button" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
|
<Preference android:title="hide-next-prev-button" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="hide-endscreen-cards" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="hide-endscreen-cards" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="hide-info-cards" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="hide-info-cards" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="hide-channel-watermark" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="hide-channel-watermark" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
|
Reference in New Issue
Block a user