mirror of
https://github.com/revanced/revanced-patches
synced 2024-11-06 22:27:00 +01:00
feat(youtube): remove-player-button-background
patch (#855)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
56fbb4aa66
commit
9e14817fd2
@ -0,0 +1,12 @@
|
||||
package app.revanced.patches.youtube.layout.playerbuttonbackground.annotations
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[
|
||||
Package("com.google.android.youtube", arrayOf("17.34.36","17.36.37", "17.36.39", "17.38.36", "17.39.35", "17.40.41", "17.42.35", "17.43.36", "17.45.36"))
|
||||
]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
internal annotation class PlayerButtonBackgroundCompatibility
|
@ -0,0 +1,41 @@
|
||||
package app.revanced.patches.youtube.layout.playerbuttonbackground.patch
|
||||
|
||||
import app.revanced.extensions.doRecursively
|
||||
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.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patches.youtube.layout.playerbuttonbackground.annotations.PlayerButtonBackgroundCompatibility
|
||||
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||
import org.w3c.dom.Element
|
||||
|
||||
@Patch
|
||||
@DependsOn([FixLocaleConfigErrorPatch::class])
|
||||
@Name("remove-player-button-background")
|
||||
@Description("Removes the background from the video player buttons.")
|
||||
@PlayerButtonBackgroundCompatibility
|
||||
@Version("0.0.1")
|
||||
class PlayerButtonBackgroundPatch : ResourcePatch {
|
||||
private companion object {
|
||||
const val RESOURCE_FILE_PATH = "res/drawable/player_button_circle_background.xml"
|
||||
}
|
||||
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
context.xmlEditor[RESOURCE_FILE_PATH].use { editor ->
|
||||
editor.file.doRecursively node@{ node ->
|
||||
if (node !is Element) return@node
|
||||
|
||||
node.getAttributeNode("android:color")?.let { attribute ->
|
||||
attribute.textContent = "@android:color/transparent"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user