This commit is contained in:
@@ -5,48 +5,52 @@
|
||||
}
|
||||
"""
|
||||
|
||||
priority = 0
|
||||
|
||||
# imports
|
||||
__author__ = "Kentai Radiquum <radiquum@gmail.com>"
|
||||
__version__ = "1.0.0"
|
||||
import os
|
||||
from tqdm import tqdm
|
||||
from lxml import etree
|
||||
from typing import Dict, Any
|
||||
from typing import Any, Dict
|
||||
|
||||
from utils.config import PatchConfig
|
||||
from lxml import etree
|
||||
from pydantic import Field
|
||||
from tqdm import tqdm
|
||||
|
||||
from utils.config import PatchTemplate
|
||||
from utils.smali_parser import get_smali_lines, save_smali_lines
|
||||
|
||||
#Config
|
||||
class Config(PatchConfig): ...
|
||||
|
||||
# Patch
|
||||
def apply(config: Config, base: Dict[str, Any]) -> bool:
|
||||
attributes = [
|
||||
"paddingTop",
|
||||
"paddingBottom",
|
||||
"paddingStart",
|
||||
"paddingEnd",
|
||||
"layout_width",
|
||||
"layout_height",
|
||||
"layout_marginTop",
|
||||
"layout_marginBottom",
|
||||
"layout_marginStart",
|
||||
"layout_marginEnd",
|
||||
]
|
||||
class Patch(PatchTemplate):
|
||||
priority: int = Field(frozen=True, exclude=True, default=0)
|
||||
|
||||
beta_banner_xml = "./decompiled/res/layout/item_beta.xml"
|
||||
if os.path.exists(beta_banner_xml):
|
||||
parser = etree.XMLParser(remove_blank_text=True)
|
||||
tree = etree.parse(beta_banner_xml, parser)
|
||||
root = tree.getroot()
|
||||
def apply(self, base: Dict[str, Any]) -> bool:
|
||||
beta_banner_xml = "./decompiled/res/layout/item_beta.xml"
|
||||
attributes = [
|
||||
"paddingTop",
|
||||
"paddingBottom",
|
||||
"paddingStart",
|
||||
"paddingEnd",
|
||||
"layout_width",
|
||||
"layout_height",
|
||||
"layout_marginTop",
|
||||
"layout_marginBottom",
|
||||
"layout_marginStart",
|
||||
"layout_marginEnd",
|
||||
]
|
||||
|
||||
for attr in attributes:
|
||||
if base.get("verbose", False):
|
||||
tqdm.write(f"set {attr} = 0.0dip")
|
||||
root.set(f"{{{base['xml_ns']['android']}}}{attr}", "0.0dip")
|
||||
if os.path.exists(beta_banner_xml):
|
||||
parser = etree.XMLParser(remove_blank_text=True)
|
||||
tree = etree.parse(beta_banner_xml, parser)
|
||||
root = tree.getroot()
|
||||
|
||||
tree.write(
|
||||
beta_banner_xml, pretty_print=True, xml_declaration=True, encoding="utf-8"
|
||||
)
|
||||
for attr in attributes:
|
||||
if base.get("verbose", False):
|
||||
tqdm.write(f"set {attr} = 0.0dip")
|
||||
root.set(f"{{{base['xml_ns']['android']}}}{attr}", "0.0dip")
|
||||
|
||||
return True
|
||||
tree.write(
|
||||
beta_banner_xml,
|
||||
pretty_print=True,
|
||||
xml_declaration=True,
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user