mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 13:17:46 +02:00
cleanup
This commit is contained in:
@ -38,6 +38,7 @@ class GeneralAdsPatch : ResourcePatch {
|
||||
"promotion_",
|
||||
"compact_premium_",
|
||||
"compact_promoted_",
|
||||
"simple_text_section",
|
||||
)
|
||||
|
||||
private val replacements = arrayOf(
|
||||
@ -46,6 +47,13 @@ class GeneralAdsPatch : ResourcePatch {
|
||||
"marginTop"
|
||||
)
|
||||
|
||||
private val additionalReplacements = arrayOf(
|
||||
"Bottom",
|
||||
"End",
|
||||
"Start",
|
||||
"Top"
|
||||
)
|
||||
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
context.forEach {
|
||||
|
||||
@ -53,11 +61,11 @@ class GeneralAdsPatch : ResourcePatch {
|
||||
|
||||
// for each file in the "layouts" directory replace all necessary attributes content
|
||||
context.xmlEditor[it.absolutePath].use { editor ->
|
||||
editor.file.doRecursively { node ->
|
||||
editor.file.doRecursively {
|
||||
replacements.forEach replacement@{ replacement ->
|
||||
if (node !is Element) return@replacement
|
||||
if (it !is Element) return@replacement
|
||||
|
||||
node.getAttributeNode("android:layout_$replacement")?.let { attribute ->
|
||||
it.getAttributeNode("android:layout_$replacement")?.let { attribute ->
|
||||
attribute.textContent = "0.0dip"
|
||||
}
|
||||
}
|
||||
@ -65,6 +73,18 @@ class GeneralAdsPatch : ResourcePatch {
|
||||
}
|
||||
}
|
||||
|
||||
context.xmlEditor["res/layout/simple_text_section.xml"].use { editor ->
|
||||
editor.file.doRecursively {
|
||||
additionalReplacements.forEach replacement@{ replacement ->
|
||||
if (it !is Element) return@replacement
|
||||
|
||||
it.getAttributeNode("android:padding_$replacement")?.let { attribute ->
|
||||
attribute.textContent = "0.0dip"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
add settings
|
||||
*/
|
||||
|
Reference in New Issue
Block a user