mirror of
https://github.com/ReVanced/revanced-patcher.git
synced 2024-11-10 01:02:22 +01:00
refactor: improve ExampleResourcePatch
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
5dc6aa9bfd
commit
5535eb4f01
2 changed files with 12 additions and 16 deletions
|
@ -1,4 +1,4 @@
|
|||
package app.revanced.patcher
|
||||
package app.revanced.patcher.usage
|
||||
|
||||
import org.junit.jupiter.api.Test
|
||||
|
|
@ -18,21 +18,17 @@ import org.w3c.dom.Element
|
|||
@Version("0.0.1")
|
||||
class ExampleResourcePatch : ResourcePatch() {
|
||||
override fun execute(data: ResourceData): PatchResult {
|
||||
val editor = data.getXmlEditor("AndroidManifest.xml")
|
||||
|
||||
// regular DomFileEditor
|
||||
val element = editor
|
||||
.file
|
||||
.getElementsByTagName("application")
|
||||
.item(0) as Element
|
||||
element
|
||||
.setAttribute(
|
||||
"exampleAttribute",
|
||||
"exampleValue"
|
||||
)
|
||||
|
||||
// close the editor to write changes
|
||||
editor.close()
|
||||
data.getXmlEditor("AndroidManifest.xml").use { domFileEditor ->
|
||||
val element = domFileEditor // regular DomFileEditor
|
||||
.file
|
||||
.getElementsByTagName("application")
|
||||
.item(0) as Element
|
||||
element
|
||||
.setAttribute(
|
||||
"exampleAttribute",
|
||||
"exampleValue"
|
||||
)
|
||||
}
|
||||
|
||||
// iterate through all available resources
|
||||
data.forEach {
|
||||
|
|
Loading…
Reference in a new issue