Улучшение cli и удобства создания патчей
Сборка мода / build (push) Successful in 2m16s

This commit is contained in:
2025-12-28 17:47:56 +03:00
parent ec047cd3a5
commit 70337ee3ec
35 changed files with 2200 additions and 1111 deletions
+26 -23
View File
@@ -5,38 +5,41 @@
}
"""
priority = 0
__author__ = "wowlikon <wowlikon@gmail.com>"
__version__ = "1.0.0"
from typing import Any, Dict
# imports
from tqdm import tqdm
from lxml import etree
from typing import Dict, Any
from pydantic import Field
from utils.config import PatchConfig
from utils.config import PatchTemplate
#Config
class Config(PatchConfig): ...
# Patch
def apply(config: Config, base: Dict[str, Any]) -> bool:
class Patch(PatchTemplate):
priority: int = Field(frozen=True, exclude=True, default=0)
file_path = "./decompiled/res/layout/release_info.xml"
def apply(self, base: Dict[str, Any]) -> bool:
file_path = "./decompiled/res/layout/release_info.xml"
parser = etree.XMLParser(remove_blank_text=True)
tree = etree.parse(file_path, parser)
root = tree.getroot()
parser = etree.XMLParser(remove_blank_text=True)
tree = etree.parse(file_path, parser)
root = tree.getroot()
# Список тегов, к которым нужно добавить атрибут
tags = ["TextView", "at.blogc.android.views.ExpandableTextView"]
# Список тегов, к которым нужно добавить атрибут
tags = ["TextView", "at.blogc.android.views.ExpandableTextView"]
for tag in tags:
for element in root.findall(f".//{tag}", namespaces=base["xml_ns"]):
# Проверяем, нет ли уже атрибута
if f"{{{base['xml_ns']['android']}}}textIsSelectable" not in element.attrib:
element.set(f"{{{base['xml_ns']['android']}}}textIsSelectable", "true")
for tag in tags:
for element in root.findall(f".//{tag}", namespaces=base["xml_ns"]):
# Проверяем, нет ли уже атрибута
if (
f"{{{base['xml_ns']['android']}}}textIsSelectable"
not in element.attrib
):
element.set(
f"{{{base['xml_ns']['android']}}}textIsSelectable", "true"
)
# Сохраняем
tree.write(file_path, encoding="utf-8", xml_declaration=True, pretty_print=True)
# Сохраняем
tree.write(file_path, encoding="utf-8", xml_declaration=True, pretty_print=True)
return True
return True