mirror of
https://github.com/ReVanced/revanced-patcher.git
synced 2026-01-24 19:51:03 +00:00
refactor: improve ResourceData.kt
Old methods have been marked as deprecated, and will be removed in the future. - ResourceData.kt was made an Iterable<File>, and the forEach method was removed in favor of Kotlin's forEach function. (no modifications required) - The resolve method was deprecated in favor of a new operator getter function, which can be either called using get(path) or data[path]. This keeps backwards compatibility with the old get method. - The getXmlEditor method was deprecated in favor of the new xmlEditor variable, which is a XmlFileHolder which has an operator getter which acts like an array. This is syntactically better.
This commit is contained in:
@@ -18,8 +18,8 @@ import org.w3c.dom.Element
|
||||
@Version("0.0.1")
|
||||
class ExampleResourcePatch : ResourcePatch() {
|
||||
override fun execute(data: ResourceData): PatchResult {
|
||||
data.getXmlEditor("AndroidManifest.xml").use { domFileEditor ->
|
||||
val element = domFileEditor // regular DomFileEditor
|
||||
data.xmlEditor["AndroidManifest.xml"].use { editor ->
|
||||
val element = editor // regular DomFileEditor
|
||||
.file
|
||||
.getElementsByTagName("application")
|
||||
.item(0) as Element
|
||||
|
||||
Reference in New Issue
Block a user