diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/etc/materialyou/patch/MaterialYouPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/etc/materialyou/patch/MaterialYouPatch.kt index d9df7ca0b..75db72797 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/etc/materialyou/patch/MaterialYouPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/etc/materialyou/patch/MaterialYouPatch.kt @@ -58,13 +58,7 @@ class MaterialYouPatch : ResourcePatch { } } - val sourcePath = this.javaClass.classLoader.getResourceAsStream("youtube/materialyou/host/values-v31/colors.xml")!! - val relativePath = context.xmlEditor["res/values-v31/colors.xml"] - - "resources".copyXmlNode( - context.xmlEditor[sourcePath], - relativePath - ) + context.copyXmlNode("youtube/materialyou/host", "values-v31/colors.xml", "resources") /* * Add settings diff --git a/src/main/kotlin/app/revanced/util/resources/IconHelper.kt b/src/main/kotlin/app/revanced/util/resources/IconHelper.kt index a1de8ce2f..f9aef43d9 100644 --- a/src/main/kotlin/app/revanced/util/resources/IconHelper.kt +++ b/src/main/kotlin/app/revanced/util/resources/IconHelper.kt @@ -44,15 +44,18 @@ internal object IconHelper { iconName ) - this.xmlEditor["res/values-v31/styles.xml"].use { editor -> - with(editor.file) { - val resourcesNode = getElementsByTagName("resources").item(0) as Element + this.xmlEditor["res/values-v31/styles.xml"].use { dom -> + val applicationNode = dom + .file + .getElementsByTagName("resources") + .item(0) as Element - for (i in 0 until resourcesNode.childNodes.length) { - val node = resourcesNode.childNodes.item(i) as? Element ?: continue - - if (node.getAttribute("name") == "Base.Theme.YouTube.Launcher") { - node.removeChild(node.childNodes.item(0)) + applicationNode.getElementsByTagName("style").also { list -> + for (i in 0 until list.length) { + val element = list.item(i) as? Element ?: continue + if (element.getAttribute("name") == "Base.Theme.YouTube.Launcher") { + element.removeChild(element.firstChild) + break } } }