mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-04-30 06:34:28 +02:00
feat(YouTube): Merge multiple player overlay patches into Hide player overlay buttons
(#3800)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
bbcb57a32d
commit
4ba0300590
@ -1670,6 +1670,12 @@ public final class app/revanced/patches/youtube/layout/buttons/navigation/Naviga
|
|||||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final class app/revanced/patches/youtube/layout/buttons/overlay/HidePlayerOverlayButtonsPatch : app/revanced/patcher/patch/BytecodePatch {
|
||||||
|
public static final field INSTANCE Lapp/revanced/patches/youtube/layout/buttons/overlay/HidePlayerOverlayButtonsPatch;
|
||||||
|
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||||
|
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||||
|
}
|
||||||
|
|
||||||
public final class app/revanced/patches/youtube/layout/buttons/player/hide/HidePlayerButtonsPatch : app/revanced/patcher/patch/BytecodePatch {
|
public final class app/revanced/patches/youtube/layout/buttons/player/hide/HidePlayerButtonsPatch : app/revanced/patcher/patch/BytecodePatch {
|
||||||
public static final field INSTANCE Lapp/revanced/patches/youtube/layout/buttons/player/hide/HidePlayerButtonsPatch;
|
public static final field INSTANCE Lapp/revanced/patches/youtube/layout/buttons/player/hide/HidePlayerButtonsPatch;
|
||||||
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||||
|
@ -9,10 +9,10 @@ import app.revanced.patcher.patch.annotation.Patch
|
|||||||
import app.revanced.patches.all.misc.resources.AddResourcesPatch
|
import app.revanced.patches.all.misc.resources.AddResourcesPatch
|
||||||
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
|
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
|
||||||
import app.revanced.patches.youtube.layout.autocaptions.fingerprints.StartVideoInformerFingerprint
|
import app.revanced.patches.youtube.layout.autocaptions.fingerprints.StartVideoInformerFingerprint
|
||||||
import app.revanced.patches.youtube.layout.autocaptions.fingerprints.SubtitleButtonControllerFingerprint
|
|
||||||
import app.revanced.patches.youtube.layout.autocaptions.fingerprints.SubtitleTrackFingerprint
|
import app.revanced.patches.youtube.layout.autocaptions.fingerprints.SubtitleTrackFingerprint
|
||||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||||
|
import app.revanced.patches.youtube.shared.fingerprints.SubtitleButtonControllerFingerprint
|
||||||
import app.revanced.util.exception
|
import app.revanced.util.exception
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,84 +1,14 @@
|
|||||||
package app.revanced.patches.youtube.layout.buttons.autoplay
|
package app.revanced.patches.youtube.layout.buttons.autoplay
|
||||||
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
import app.revanced.patches.youtube.layout.buttons.overlay.HidePlayerOverlayButtonsPatch
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
|
||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
|
||||||
import app.revanced.patches.all.misc.resources.AddResourcesPatch
|
|
||||||
import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch
|
|
||||||
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
|
|
||||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
|
||||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
|
||||||
import app.revanced.patches.youtube.shared.fingerprints.LayoutConstructorFingerprint
|
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
|
||||||
import app.revanced.util.indexOfIdResourceOrThrow
|
|
||||||
import app.revanced.util.resultOrThrow
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
@Patch(
|
|
||||||
name = "Hide autoplay button",
|
|
||||||
description = "Adds an option to hide the autoplay button in the video player.",
|
|
||||||
dependencies = [
|
|
||||||
IntegrationsPatch::class,
|
|
||||||
SettingsPatch::class,
|
|
||||||
ResourceMappingPatch::class,
|
|
||||||
AddResourcesPatch::class,
|
|
||||||
],
|
|
||||||
compatiblePackages = [
|
|
||||||
CompatiblePackage(
|
|
||||||
"com.google.android.youtube",
|
|
||||||
[
|
|
||||||
"18.38.44",
|
|
||||||
"18.49.37",
|
|
||||||
"19.16.39",
|
|
||||||
"19.25.37",
|
|
||||||
"19.34.42",
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
|
@Deprecated("This patch has been merged into HidePlayerOverlayButtonsPatch.")
|
||||||
object HideAutoplayButtonPatch : BytecodePatch(
|
object HideAutoplayButtonPatch : BytecodePatch(
|
||||||
setOf(LayoutConstructorFingerprint),
|
dependencies = setOf(HidePlayerOverlayButtonsPatch::class),
|
||||||
) {
|
) {
|
||||||
|
|
||||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
|
||||||
"Lapp/revanced/integrations/youtube/patches/HideAutoplayButtonPatch;"
|
|
||||||
|
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
AddResourcesPatch(this::class)
|
|
||||||
|
|
||||||
SettingsPatch.PreferenceScreen.PLAYER.addPreferences(
|
|
||||||
SwitchPreference("revanced_hide_autoplay_button"),
|
|
||||||
)
|
|
||||||
|
|
||||||
LayoutConstructorFingerprint.resultOrThrow().mutableMethod.apply {
|
|
||||||
val constIndex = indexOfIdResourceOrThrow("autonav_toggle")
|
|
||||||
val constRegister = getInstruction<OneRegisterInstruction>(constIndex).registerA
|
|
||||||
|
|
||||||
// Add a conditional branch around the code that inflates and adds the auto repeat button.
|
|
||||||
val gotoIndex = indexOfFirstInstructionOrThrow(constIndex) {
|
|
||||||
val parameterTypes = getReference<MethodReference>()?.parameterTypes
|
|
||||||
opcode == Opcode.INVOKE_VIRTUAL &&
|
|
||||||
parameterTypes?.size == 2 &&
|
|
||||||
parameterTypes.first() == "Landroid/view/ViewStub;"
|
|
||||||
} + 1
|
|
||||||
|
|
||||||
addInstructionsWithLabels(
|
|
||||||
constIndex,
|
|
||||||
"""
|
|
||||||
invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->hideAutoPlayButton()Z
|
|
||||||
move-result v$constRegister
|
|
||||||
if-nez v$constRegister, :hidden
|
|
||||||
""",
|
|
||||||
ExternalLabel("hidden", getInstruction(gotoIndex)),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,61 +1,14 @@
|
|||||||
package app.revanced.patches.youtube.layout.buttons.captions
|
package app.revanced.patches.youtube.layout.buttons.captions
|
||||||
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
import app.revanced.patches.youtube.layout.buttons.overlay.HidePlayerOverlayButtonsPatch
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
|
||||||
import app.revanced.patches.all.misc.resources.AddResourcesPatch
|
|
||||||
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
|
|
||||||
import app.revanced.patches.youtube.layout.autocaptions.fingerprints.SubtitleButtonControllerFingerprint
|
|
||||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
|
||||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
|
||||||
|
|
||||||
@Patch(
|
|
||||||
name = "Hide captions button",
|
|
||||||
description = "Adds an option to hide the captions button in the video player.",
|
|
||||||
dependencies = [
|
|
||||||
IntegrationsPatch::class,
|
|
||||||
SettingsPatch::class,
|
|
||||||
AddResourcesPatch::class
|
|
||||||
],
|
|
||||||
compatiblePackages = [
|
|
||||||
CompatiblePackage(
|
|
||||||
"com.google.android.youtube",
|
|
||||||
[
|
|
||||||
"18.38.44",
|
|
||||||
"18.49.37",
|
|
||||||
"19.16.39",
|
|
||||||
"19.25.37",
|
|
||||||
"19.34.42",
|
|
||||||
]
|
|
||||||
)
|
|
||||||
]
|
|
||||||
)
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
|
@Deprecated("This patch has been merged into HidePlayerOverlayButtonsPatch.")
|
||||||
object HideCaptionsButtonPatch : BytecodePatch(
|
object HideCaptionsButtonPatch : BytecodePatch(
|
||||||
setOf(SubtitleButtonControllerFingerprint)
|
dependencies = setOf(HidePlayerOverlayButtonsPatch::class),
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
AddResourcesPatch(this::class)
|
|
||||||
|
|
||||||
SettingsPatch.PreferenceScreen.PLAYER.addPreferences(
|
|
||||||
SwitchPreference("revanced_hide_captions_button")
|
|
||||||
)
|
|
||||||
|
|
||||||
val subtitleButtonControllerMethod = SubtitleButtonControllerFingerprint.result!!.mutableMethod
|
|
||||||
|
|
||||||
// Due to previously applied patches, scanResult index cannot be used in this context
|
|
||||||
val insertIndex = subtitleButtonControllerMethod.implementation!!.instructions.indexOfFirst {
|
|
||||||
it.opcode == Opcode.IGET_BOOLEAN
|
|
||||||
} + 1
|
|
||||||
|
|
||||||
subtitleButtonControllerMethod.addInstruction(
|
|
||||||
insertIndex,
|
|
||||||
"""
|
|
||||||
invoke-static {v0}, Lapp/revanced/integrations/youtube/patches/HideCaptionsButtonPatch;->hideCaptionsButton(Landroid/widget/ImageView;)V
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,47 +1,14 @@
|
|||||||
package app.revanced.patches.youtube.layout.buttons.cast
|
package app.revanced.patches.youtube.layout.buttons.cast
|
||||||
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchException
|
import app.revanced.patches.youtube.layout.buttons.overlay.HidePlayerOverlayButtonsPatch
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
|
||||||
import app.revanced.patches.all.misc.resources.AddResourcesPatch
|
|
||||||
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
|
|
||||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
|
||||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
|
||||||
|
|
||||||
@Patch(
|
@Suppress("unused")
|
||||||
name = "Hide cast button",
|
@Deprecated("This patch has been merged into HidePlayerOverlayButtonsPatch.")
|
||||||
description = "Adds an option to hide the cast button in the video player.",
|
object HideCastButtonPatch : BytecodePatch(
|
||||||
dependencies = [
|
dependencies = setOf(HidePlayerOverlayButtonsPatch::class),
|
||||||
IntegrationsPatch::class,
|
) {
|
||||||
SettingsPatch::class,
|
|
||||||
AddResourcesPatch::class,
|
|
||||||
],
|
|
||||||
compatiblePackages = [
|
|
||||||
CompatiblePackage("com.google.android.youtube"),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
object HideCastButtonPatch : BytecodePatch(emptySet()) {
|
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
AddResourcesPatch(this::class)
|
|
||||||
|
|
||||||
SettingsPatch.PreferenceScreen.PLAYER.addPreferences(
|
|
||||||
SwitchPreference("revanced_hide_cast_button")
|
|
||||||
)
|
|
||||||
|
|
||||||
val buttonClass = context.findClass("MediaRouteButton")
|
|
||||||
?: throw PatchException("MediaRouteButton class not found.")
|
|
||||||
|
|
||||||
buttonClass.mutableClass.methods.find { it.name == "setVisibility" }?.apply {
|
|
||||||
addInstructions(
|
|
||||||
0,
|
|
||||||
"""
|
|
||||||
invoke-static {p1}, Lapp/revanced/integrations/youtube/patches/HideCastButtonPatch;->getCastButtonOverrideV2(I)I
|
|
||||||
move-result p1
|
|
||||||
""",
|
|
||||||
)
|
|
||||||
} ?: throw PatchException("setVisibility method not found.")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,151 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.buttons.overlay
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
|
import app.revanced.patches.all.misc.resources.AddResourcesPatch
|
||||||
|
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
|
||||||
|
import app.revanced.patches.youtube.layout.buttons.overlay.fingerprints.MediaRouteButtonFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.buttons.overlay.fingerprints.PlayerControlsPreviousNextOverlayTouchFingerprint
|
||||||
|
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||||
|
import app.revanced.patches.youtube.shared.fingerprints.LayoutConstructorFingerprint
|
||||||
|
import app.revanced.patches.youtube.shared.fingerprints.SubtitleButtonControllerFingerprint
|
||||||
|
import app.revanced.util.getReference
|
||||||
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
|
import app.revanced.util.indexOfFirstWideLiteralInstructionValueOrThrow
|
||||||
|
import app.revanced.util.indexOfIdResourceOrThrow
|
||||||
|
import app.revanced.util.resultOrThrow
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||||
|
|
||||||
|
@Patch(
|
||||||
|
name = "Hide player overlay buttons",
|
||||||
|
description = "Adds options to hide the player cast, autoplay, caption button and next/ previous buttons.",
|
||||||
|
dependencies = [
|
||||||
|
IntegrationsPatch::class,
|
||||||
|
SettingsPatch::class,
|
||||||
|
AddResourcesPatch::class,
|
||||||
|
HidePlayerOverlayButtonsResourcePatch::class,
|
||||||
|
],
|
||||||
|
compatiblePackages = [
|
||||||
|
CompatiblePackage(
|
||||||
|
"com.google.android.youtube",
|
||||||
|
[
|
||||||
|
"18.38.44",
|
||||||
|
"18.49.37",
|
||||||
|
"19.16.39",
|
||||||
|
"19.25.37",
|
||||||
|
"19.34.42",
|
||||||
|
]
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
@Suppress("unused")
|
||||||
|
object HidePlayerOverlayButtonsPatch : BytecodePatch(
|
||||||
|
setOf(
|
||||||
|
PlayerControlsPreviousNextOverlayTouchFingerprint,
|
||||||
|
MediaRouteButtonFingerprint,
|
||||||
|
SubtitleButtonControllerFingerprint,
|
||||||
|
LayoutConstructorFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
|
||||||
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||||
|
"Lapp/revanced/integrations/youtube/patches/HidePlayerOverlayButtonsPatch;"
|
||||||
|
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
AddResourcesPatch(this::class)
|
||||||
|
|
||||||
|
SettingsPatch.PreferenceScreen.PLAYER.addPreferences(
|
||||||
|
SwitchPreference("revanced_hide_player_previous_next_buttons"),
|
||||||
|
SwitchPreference("revanced_hide_cast_button"),
|
||||||
|
SwitchPreference("revanced_hide_captions_button"),
|
||||||
|
SwitchPreference("revanced_hide_autoplay_button"),
|
||||||
|
)
|
||||||
|
|
||||||
|
// region hide player next/previous button
|
||||||
|
|
||||||
|
PlayerControlsPreviousNextOverlayTouchFingerprint.resultOrThrow().mutableMethod.apply {
|
||||||
|
val resourceIndex = indexOfFirstWideLiteralInstructionValueOrThrow(
|
||||||
|
HidePlayerOverlayButtonsResourcePatch.playerControlPreviousButtonTouchArea
|
||||||
|
)
|
||||||
|
|
||||||
|
val insertIndex = indexOfFirstInstructionOrThrow(resourceIndex) {
|
||||||
|
opcode == Opcode.INVOKE_STATIC
|
||||||
|
&& getReference<MethodReference>()?.parameterTypes?.firstOrNull() == "Landroid/view/View;"
|
||||||
|
}
|
||||||
|
|
||||||
|
val viewRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerC
|
||||||
|
|
||||||
|
addInstruction(
|
||||||
|
insertIndex,
|
||||||
|
"invoke-static { v$viewRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR" +
|
||||||
|
"->hidePreviousNextButtons(Landroid/view/View;)V"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// region hide cast button
|
||||||
|
|
||||||
|
MediaRouteButtonFingerprint.resultOrThrow().mutableMethod.addInstructions(
|
||||||
|
0,
|
||||||
|
"""
|
||||||
|
invoke-static { p1 }, $INTEGRATIONS_CLASS_DESCRIPTOR->getCastButtonOverrideV2(I)I
|
||||||
|
move-result p1
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// region hide captions button
|
||||||
|
|
||||||
|
SubtitleButtonControllerFingerprint.resultOrThrow().mutableMethod.apply {
|
||||||
|
// Due to previously applied patches, scanResult index cannot be used in this context
|
||||||
|
val insertIndex = indexOfFirstInstructionOrThrow(Opcode.IGET_BOOLEAN) + 1
|
||||||
|
|
||||||
|
addInstruction(
|
||||||
|
insertIndex,
|
||||||
|
"invoke-static {v0}, $INTEGRATIONS_CLASS_DESCRIPTOR->hideCaptionsButton(Landroid/widget/ImageView;)V"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// region hide auto play button
|
||||||
|
|
||||||
|
LayoutConstructorFingerprint.resultOrThrow().mutableMethod.apply {
|
||||||
|
val constIndex = indexOfIdResourceOrThrow("autonav_toggle")
|
||||||
|
val constRegister = getInstruction<OneRegisterInstruction>(constIndex).registerA
|
||||||
|
|
||||||
|
// Add a conditional branch around the code that inflates and adds the auto repeat button.
|
||||||
|
val gotoIndex = indexOfFirstInstructionOrThrow(constIndex) {
|
||||||
|
val parameterTypes = getReference<MethodReference>()?.parameterTypes
|
||||||
|
opcode == Opcode.INVOKE_VIRTUAL &&
|
||||||
|
parameterTypes?.size == 2 &&
|
||||||
|
parameterTypes.first() == "Landroid/view/ViewStub;"
|
||||||
|
} + 1
|
||||||
|
|
||||||
|
addInstructionsWithLabels(
|
||||||
|
constIndex,
|
||||||
|
"""
|
||||||
|
invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->hideAutoPlayButton()Z
|
||||||
|
move-result v$constRegister
|
||||||
|
if-nez v$constRegister, :hidden
|
||||||
|
""",
|
||||||
|
ExternalLabel("hidden", getInstruction(gotoIndex)),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// endregion
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.layout.buttons.player.hide
|
package app.revanced.patches.youtube.layout.buttons.overlay
|
||||||
|
|
||||||
import app.revanced.patcher.data.ResourceContext
|
import app.revanced.patcher.data.ResourceContext
|
||||||
import app.revanced.patcher.patch.ResourcePatch
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
@ -6,7 +6,7 @@ import app.revanced.patcher.patch.annotation.Patch
|
|||||||
import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch
|
import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch
|
||||||
|
|
||||||
@Patch(dependencies = [ResourceMappingPatch::class])
|
@Patch(dependencies = [ResourceMappingPatch::class])
|
||||||
internal object HidePlayerButtonsResourcePatch : ResourcePatch() {
|
internal object HidePlayerOverlayButtonsResourcePatch : ResourcePatch() {
|
||||||
var playerControlPreviousButtonTouchArea = -1L
|
var playerControlPreviousButtonTouchArea = -1L
|
||||||
var playerControlNextButtonTouchArea = -1L
|
var playerControlNextButtonTouchArea = -1L
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.buttons.overlay.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
|
||||||
|
internal object MediaRouteButtonFingerprint : MethodFingerprint (
|
||||||
|
parameters = listOf("I"),
|
||||||
|
customFingerprint = { methodDef, _ ->
|
||||||
|
methodDef.definingClass.endsWith("/MediaRouteButton;") && methodDef.name == "setVisibility"
|
||||||
|
}
|
||||||
|
)
|
@ -1,8 +1,8 @@
|
|||||||
package app.revanced.patches.youtube.layout.buttons.player.hide.fingerprints
|
package app.revanced.patches.youtube.layout.buttons.overlay.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.layout.buttons.player.hide.HidePlayerButtonsResourcePatch
|
import app.revanced.patches.youtube.layout.buttons.overlay.HidePlayerOverlayButtonsResourcePatch
|
||||||
import app.revanced.util.containsWideLiteralInstructionValue
|
import app.revanced.util.containsWideLiteralInstructionValue
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
|
||||||
@ -12,9 +12,9 @@ internal object PlayerControlsPreviousNextOverlayTouchFingerprint : MethodFinger
|
|||||||
strings = listOf("1.0x"),
|
strings = listOf("1.0x"),
|
||||||
customFingerprint = { methodDef, _ ->
|
customFingerprint = { methodDef, _ ->
|
||||||
methodDef.containsWideLiteralInstructionValue(
|
methodDef.containsWideLiteralInstructionValue(
|
||||||
HidePlayerButtonsResourcePatch.playerControlPreviousButtonTouchArea
|
HidePlayerOverlayButtonsResourcePatch.playerControlPreviousButtonTouchArea
|
||||||
) && methodDef.containsWideLiteralInstructionValue(
|
) && methodDef.containsWideLiteralInstructionValue(
|
||||||
HidePlayerButtonsResourcePatch.playerControlNextButtonTouchArea
|
HidePlayerOverlayButtonsResourcePatch.playerControlNextButtonTouchArea
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
@ -1,74 +1,13 @@
|
|||||||
package app.revanced.patches.youtube.layout.buttons.player.hide
|
package app.revanced.patches.youtube.layout.buttons.player.hide
|
||||||
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
import app.revanced.patches.youtube.layout.buttons.overlay.HidePlayerOverlayButtonsPatch
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
|
||||||
import app.revanced.patches.all.misc.resources.AddResourcesPatch
|
|
||||||
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
|
|
||||||
import app.revanced.patches.youtube.layout.buttons.player.hide.fingerprints.PlayerControlsPreviousNextOverlayTouchFingerprint
|
|
||||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
|
||||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
|
||||||
import app.revanced.util.getReference
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
|
||||||
import app.revanced.util.indexOfFirstWideLiteralInstructionValueOrThrow
|
|
||||||
import app.revanced.util.resultOrThrow
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
@Patch(
|
@Deprecated("This patch has been merged into HidePlayerOverlayButtonsPatch.")
|
||||||
name = "Hide player buttons",
|
|
||||||
description = "Adds an option to hide the previous and next buttons in the video player.",
|
|
||||||
dependencies = [
|
|
||||||
IntegrationsPatch::class,
|
|
||||||
SettingsPatch::class,
|
|
||||||
AddResourcesPatch::class,
|
|
||||||
HidePlayerButtonsResourcePatch::class,
|
|
||||||
],
|
|
||||||
compatiblePackages = [
|
|
||||||
CompatiblePackage(
|
|
||||||
"com.google.android.youtube",
|
|
||||||
[
|
|
||||||
"18.38.44",
|
|
||||||
"18.49.37",
|
|
||||||
"19.16.39",
|
|
||||||
"19.25.37",
|
|
||||||
"19.34.42",
|
|
||||||
]
|
|
||||||
)
|
|
||||||
]
|
|
||||||
)
|
|
||||||
@Suppress("unused")
|
|
||||||
object HidePlayerButtonsPatch : BytecodePatch(
|
object HidePlayerButtonsPatch : BytecodePatch(
|
||||||
setOf(PlayerControlsPreviousNextOverlayTouchFingerprint)
|
dependencies = setOf(HidePlayerOverlayButtonsPatch::class),
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
AddResourcesPatch(this::class)
|
|
||||||
|
|
||||||
SettingsPatch.PreferenceScreen.PLAYER.addPreferences(
|
|
||||||
SwitchPreference("revanced_hide_player_buttons")
|
|
||||||
)
|
|
||||||
|
|
||||||
PlayerControlsPreviousNextOverlayTouchFingerprint.resultOrThrow().mutableMethod.apply {
|
|
||||||
val resourceIndex = indexOfFirstWideLiteralInstructionValueOrThrow(
|
|
||||||
HidePlayerButtonsResourcePatch.playerControlPreviousButtonTouchArea
|
|
||||||
)
|
|
||||||
|
|
||||||
val insertIndex = indexOfFirstInstructionOrThrow(resourceIndex) {
|
|
||||||
opcode == Opcode.INVOKE_STATIC
|
|
||||||
&& getReference<MethodReference>()?.parameterTypes?.firstOrNull() == "Landroid/view/View;"
|
|
||||||
}
|
|
||||||
|
|
||||||
val viewRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerC
|
|
||||||
|
|
||||||
addInstruction(
|
|
||||||
insertIndex,
|
|
||||||
"invoke-static { v$viewRegister }, Lapp/revanced/integrations/youtube/patches/HidePlayerButtonsPatch;" +
|
|
||||||
"->hidePreviousNextButtons(Landroid/view/View;)V"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,7 +2,7 @@ package app.revanced.patches.youtube.misc.gms
|
|||||||
|
|
||||||
import app.revanced.patches.shared.fingerprints.CastContextFetchFingerprint
|
import app.revanced.patches.shared.fingerprints.CastContextFetchFingerprint
|
||||||
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch
|
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch
|
||||||
import app.revanced.patches.youtube.layout.buttons.cast.HideCastButtonPatch
|
import app.revanced.patches.youtube.layout.buttons.overlay.HidePlayerOverlayButtonsPatch
|
||||||
import app.revanced.patches.youtube.misc.fix.playback.SpoofVideoStreamsPatch
|
import app.revanced.patches.youtube.misc.fix.playback.SpoofVideoStreamsPatch
|
||||||
import app.revanced.patches.youtube.misc.gms.Constants.REVANCED_YOUTUBE_PACKAGE_NAME
|
import app.revanced.patches.youtube.misc.gms.Constants.REVANCED_YOUTUBE_PACKAGE_NAME
|
||||||
import app.revanced.patches.youtube.misc.gms.Constants.YOUTUBE_PACKAGE_NAME
|
import app.revanced.patches.youtube.misc.gms.Constants.YOUTUBE_PACKAGE_NAME
|
||||||
@ -22,7 +22,7 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch(
|
|||||||
mainActivityOnCreateFingerprint = MainActivityOnCreateFingerprint,
|
mainActivityOnCreateFingerprint = MainActivityOnCreateFingerprint,
|
||||||
integrationsPatchDependency = IntegrationsPatch::class,
|
integrationsPatchDependency = IntegrationsPatch::class,
|
||||||
dependencies = setOf(
|
dependencies = setOf(
|
||||||
HideCastButtonPatch::class,
|
HidePlayerOverlayButtonsPatch::class, // Hide non functional cast button.
|
||||||
SpoofVideoStreamsPatch::class,
|
SpoofVideoStreamsPatch::class,
|
||||||
),
|
),
|
||||||
gmsCoreSupportResourcePatch = GmsCoreSupportResourcePatch,
|
gmsCoreSupportResourcePatch = GmsCoreSupportResourcePatch,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.layout.autocaptions.fingerprints
|
package app.revanced.patches.youtube.shared.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
@ -472,22 +472,6 @@ This is because Crowdin requires temporarily flattening this file and removing t
|
|||||||
<string name="revanced_hide_playlist_button_summary_on">Save to playlist button is hidden</string>
|
<string name="revanced_hide_playlist_button_summary_on">Save to playlist button is hidden</string>
|
||||||
<string name="revanced_hide_playlist_button_summary_off">Save to playlist button is shown</string>
|
<string name="revanced_hide_playlist_button_summary_off">Save to playlist button is shown</string>
|
||||||
</patch>
|
</patch>
|
||||||
<patch id="layout.buttons.autoplay.HideAutoplayButtonPatch">
|
|
||||||
<string name="revanced_hide_autoplay_button_title">Hide autoplay button</string>
|
|
||||||
<string name="revanced_hide_autoplay_button_summary_on">Autoplay button is hidden</string>
|
|
||||||
<string name="revanced_hide_autoplay_button_summary_off">Autoplay button is shown</string>
|
|
||||||
</patch>
|
|
||||||
<patch id="layout.buttons.captions.HideCaptionsButtonPatch">
|
|
||||||
<!-- This button does not display any text, but 'captions' should be translated using the same wording used as the translation of 'revanced_hide_player_flyout_captions_title' -->
|
|
||||||
<string name="revanced_hide_captions_button_title">Hide captions button</string>
|
|
||||||
<string name="revanced_hide_captions_button_summary_on">Captions button is hidden</string>
|
|
||||||
<string name="revanced_hide_captions_button_summary_off">Captions button is shown</string>
|
|
||||||
</patch>
|
|
||||||
<patch id="layout.buttons.cast.HideCastButtonPatch">
|
|
||||||
<string name="revanced_hide_cast_button_title">Hide cast button</string>
|
|
||||||
<string name="revanced_hide_cast_button_summary_on">Cast button is hidden</string>
|
|
||||||
<string name="revanced_hide_cast_button_summary_off">Cast button is shown</string>
|
|
||||||
</patch>
|
|
||||||
<patch id="layout.buttons.navigation.NavigationButtonsPatch">
|
<patch id="layout.buttons.navigation.NavigationButtonsPatch">
|
||||||
<string name="revanced_navigation_buttons_screen_title">Navigation buttons</string>
|
<string name="revanced_navigation_buttons_screen_title">Navigation buttons</string>
|
||||||
<string name="revanced_navigation_buttons_screen_summary">Hide or change buttons in the navigation bar</string>
|
<string name="revanced_navigation_buttons_screen_summary">Hide or change buttons in the navigation bar</string>
|
||||||
@ -560,10 +544,20 @@ This is because Crowdin requires temporarily flattening this file and removing t
|
|||||||
<string name="revanced_hide_player_flyout_watch_in_vr_summary_on">Watch in VR menu is hidden</string>
|
<string name="revanced_hide_player_flyout_watch_in_vr_summary_on">Watch in VR menu is hidden</string>
|
||||||
<string name="revanced_hide_player_flyout_watch_in_vr_summary_off">Watch in VR menu is shown</string>
|
<string name="revanced_hide_player_flyout_watch_in_vr_summary_off">Watch in VR menu is shown</string>
|
||||||
</patch>
|
</patch>
|
||||||
<patch id="layout.buttons.player.hide.HidePlayerButtonsPatch">
|
<patch id="layout.buttons.overlay.HidePlayerOverlayButtonsPatch">
|
||||||
<string name="revanced_hide_player_buttons_title">Hide previous & next video buttons</string>
|
<string name="revanced_hide_player_previous_next_buttons_title">Hide previous & next video buttons</string>
|
||||||
<string name="revanced_hide_player_buttons_summary_on">Buttons are hidden</string>
|
<string name="revanced_hide_player_previous_next_buttons_summary_on">Buttons are hidden</string>
|
||||||
<string name="revanced_hide_player_buttons_summary_off">Buttons are shown</string>
|
<string name="revanced_hide_player_previous_next_buttons_summary_off">Buttons are shown</string>
|
||||||
|
<string name="revanced_hide_cast_button_title">Hide cast button</string>
|
||||||
|
<string name="revanced_hide_cast_button_summary_on">Cast button is hidden</string>
|
||||||
|
<string name="revanced_hide_cast_button_summary_off">Cast button is shown</string>
|
||||||
|
<!-- This button does not display any text, but 'captions' should be translated using the same wording used as the translation of 'revanced_hide_player_flyout_captions_title' -->
|
||||||
|
<string name="revanced_hide_captions_button_title">Hide captions button</string>
|
||||||
|
<string name="revanced_hide_captions_button_summary_on">Captions button is hidden</string>
|
||||||
|
<string name="revanced_hide_captions_button_summary_off">Captions button is shown</string>
|
||||||
|
<string name="revanced_hide_autoplay_button_title">Hide autoplay button</string>
|
||||||
|
<string name="revanced_hide_autoplay_button_summary_on">Autoplay button is hidden</string>
|
||||||
|
<string name="revanced_hide_autoplay_button_summary_off">Autoplay button is shown</string>
|
||||||
</patch>
|
</patch>
|
||||||
<patch id="layout.hide.endscreencards.HideEndscreenCardsResourcePatch">
|
<patch id="layout.hide.endscreencards.HideEndscreenCardsResourcePatch">
|
||||||
<string name="revanced_hide_endscreen_cards_title">Hide end screen cards</string>
|
<string name="revanced_hide_endscreen_cards_title">Hide end screen cards</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user