mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-11 12:04:39 +02:00
fix(YouTube/Hide player button background): match to official ReVanced code
This commit is contained in:
parent
04f821851f
commit
62573fbca5
@ -1,23 +1,17 @@
|
||||
package app.revanced.patches.youtube.player.playerbuttonbg
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.extensions.doRecursively
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.player.playerbuttonbg.fingerprints.PlayerPatchFingerprint
|
||||
import app.revanced.patches.youtube.utils.playerbutton.PlayerButtonHookPatch
|
||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.INTEGRATIONS_PATH
|
||||
import org.w3c.dom.Element
|
||||
|
||||
@Patch(
|
||||
name = "Hide player button background",
|
||||
description = "Hide player button background.",
|
||||
dependencies = [
|
||||
PlayerButtonHookPatch::class,
|
||||
SettingsPatch::class
|
||||
],
|
||||
dependencies = [SettingsPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
@ -41,20 +35,24 @@ import app.revanced.util.integrations.Constants.INTEGRATIONS_PATH
|
||||
"18.43.45"
|
||||
]
|
||||
)
|
||||
]
|
||||
],
|
||||
use = false
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HidePlayerButtonBackgroundPatch : BytecodePatch(
|
||||
setOf(PlayerPatchFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
object HidePlayerButtonBackgroundPatch : ResourcePatch() {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
PlayerPatchFingerprint.result?.mutableMethod?.addInstruction(
|
||||
0,
|
||||
"invoke-static {p0}, " +
|
||||
"$INTEGRATIONS_PATH/utils/ResourceHelper;->" +
|
||||
"hidePlayerButtonBackground(Landroid/view/View;)V"
|
||||
) ?: throw PlayerPatchFingerprint.exception
|
||||
context.xmlEditor["res/drawable/player_button_circle_background.xml"].use { editor ->
|
||||
editor.file.doRecursively { node ->
|
||||
arrayOf("color").forEach replacement@{ replacement ->
|
||||
if (node !is Element) return@replacement
|
||||
|
||||
node.getAttributeNode("android:$replacement")?.let { attribute ->
|
||||
attribute.textContent = "@android:color/transparent"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
|
@ -1,10 +0,0 @@
|
||||
package app.revanced.patches.youtube.player.playerbuttonbg.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
|
||||
object PlayerPatchFingerprint : MethodFingerprint(
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.definingClass == "Lapp/revanced/integrations/patches/layout/PlayerPatch;"
|
||||
&& methodDef.name == "hidePlayerButton"
|
||||
}
|
||||
)
|
@ -419,9 +419,6 @@ Some components may not be hidden."</string>
|
||||
<string name="revanced_hide_place_section_summary_off">Place sections are shown.</string>
|
||||
<string name="revanced_hide_place_section_summary_on">Place sections are hidden.</string>
|
||||
<string name="revanced_hide_place_section_title">Hide place sections</string>
|
||||
<string name="revanced_hide_player_button_background_summary_off">Player button background is shown.</string>
|
||||
<string name="revanced_hide_player_button_background_summary_on">Player button background is hidden.</string>
|
||||
<string name="revanced_hide_player_button_background_title">Hide player button background</string>
|
||||
<string name="revanced_hide_player_flyout_panel_ambient_mode_summary_off">Ambient mode menu is shown.</string>
|
||||
<string name="revanced_hide_player_flyout_panel_ambient_mode_summary_on">Ambient mode menu is hidden.</string>
|
||||
<string name="revanced_hide_player_flyout_panel_ambient_mode_title">Hide ambient mode menu</string>
|
||||
|
@ -548,9 +548,6 @@
|
||||
<!-- SETTINGS: HIDE_INFO_CARDS
|
||||
<SwitchPreference android:title="@string/revanced_hide_info_cards_title" android:key="revanced_hide_info_cards" android:defaultValue="false" android:summaryOn="@string/revanced_hide_info_cards_summary_on" android:summaryOff="@string/revanced_hide_info_cards_summary_off" />SETTINGS: HIDE_INFO_CARDS -->
|
||||
|
||||
<!-- SETTINGS: HIDE_PLAYER_BUTTON_BACKGROUND
|
||||
<SwitchPreference android:title="@string/revanced_hide_player_button_background_title" android:key="revanced_hide_player_button_background" android:defaultValue="false" android:summaryOn="@string/revanced_hide_player_button_background_summary_on" android:summaryOff="@string/revanced_hide_player_button_background_summary_off" />SETTINGS: HIDE_PLAYER_BUTTON_BACKGROUND -->
|
||||
|
||||
<!-- SETTINGS: HIDE_PREVIOUS_NEXT_BUTTON
|
||||
<SwitchPreference android:title="@string/revanced_hide_previous_next_button_title" android:key="revanced_hide_previous_next_button" android:defaultValue="false" android:summaryOn="@string/revanced_hide_previous_next_button_summary_on" android:summaryOff="@string/revanced_hide_previous_next_button_summary_off" />SETTINGS: HIDE_PREVIOUS_NEXT_BUTTON -->
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user