From 24a8a1d4d3c7a0249a36a09ed069472e08a97a56 Mon Sep 17 00:00:00 2001 From: wowlikon Date: Sun, 14 Sep 2025 21:46:39 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B0=D1=82=D1=87=20=D0=BF=D0=B0=D0=BD?= =?UTF-8?q?=D0=B5=D0=BB=D0=B8=20=D0=BD=D0=B0=D0=B2=D0=B8=D0=B3=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=B8=20=D0=BF=D0=BE=D0=B4=D0=BF=D0=B8=D1=81?= =?UTF-8?q?=D0=B8=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D0=B8=20=D0=B2=20=D0=BD?= =?UTF-8?q?=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B9=D0=BA=D0=B0=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.json | 10 +++++++--- patches/color_theme.py | 1 + patches/replace_navbar.py | 41 +++++++++++++++++++++++++++++++++++++++ patches/settings_urls.py | 15 ++++++++++++++ todo_drafts/todo1.txt | 29 +++++++++++++++++++++++++-- todo_drafts/todo2.txt | 27 -------------------------- 6 files changed, 91 insertions(+), 32 deletions(-) create mode 100644 patches/replace_navbar.py delete mode 100644 todo_drafts/todo2.txt diff --git a/config.json b/config.json index 2a2a5fc..e9b81e4 100644 --- a/config.json +++ b/config.json @@ -38,6 +38,9 @@ "to": "#ffccff00" } }, + "replace_navbar": { + "items": ["home", "discover", "feed", "bookmarks", "profile"] + }, "custom_speed": { "speeds": [9.0] }, @@ -68,14 +71,15 @@ ], "Прочее": [ { - "title": "Поддержать проект", - "description": "После пожертвования вы сможете выбрать в своём профиле любую роль, например «Кошка-девочка», которая будет видна всем пользователям мода.", + "title": "Помочь проекту", + "description": "Вы можете помочь нам в разработке мода, написании кода или тестировании.", "url": "https://t.me/wowlikon", "icon": "@drawable/ic_custom_crown", "icon_space_reserved": "false" } ] - } + }, + "version": " by wowlikon" } } } diff --git a/patches/color_theme.py b/patches/color_theme.py index 24e5928..8cdd0eb 100644 --- a/patches/color_theme.py +++ b/patches/color_theme.py @@ -9,6 +9,7 @@ from utils.public import ( change_color, ) + def apply(config: dict) -> bool: main_color = config["colors"]["primary"] splash_color = config["colors"]["secondary"] diff --git a/patches/replace_navbar.py b/patches/replace_navbar.py new file mode 100644 index 0000000..bdbece0 --- /dev/null +++ b/patches/replace_navbar.py @@ -0,0 +1,41 @@ +"""Replace navbar items""" +priority = 0 + +from lxml import etree +from tqdm import tqdm + +def apply(config: dict) -> bool: + file_path = "./decompiled/res/menu/bottom.xml" + + parser = etree.XMLParser(remove_blank_text=True) + tree = etree.parse(file_path, parser) + root = tree.getroot() + + items = root.findall("item", namespaces=config['xml_ns']) + + def get_id_suffix(item): + full_id = item.get(f"{{{config['xml_ns']['android']}}}id") + return full_id.split("tab_")[-1] if full_id else None + + items_by_id = {get_id_suffix(item): item for item in items} + existing_order = [get_id_suffix(item) for item in items] + + ordered_items = [] + for key in config['items']: + if key in items_by_id: + ordered_items.append(items_by_id[key]) + + extra = [i for i in items if get_id_suffix(i) not in config['items']] + if extra: + tqdm.write("⚠Найдены лишние элементы: " + str([get_id_suffix(i) for i in extra])) + ordered_items.extend(extra) + + for i in root.findall("item", namespaces=config['xml_ns']): + root.remove(i) + + for item in ordered_items: + root.append(item) + + tree.write(file_path, pretty_print=True, xml_declaration=True, encoding="utf-8") + + return True diff --git a/patches/settings_urls.py b/patches/settings_urls.py index 22a8b40..d75a9c6 100644 --- a/patches/settings_urls.py +++ b/patches/settings_urls.py @@ -38,4 +38,19 @@ def apply(config: dict) -> bool: # Save back tree.write(file_path, pretty_print=True, xml_declaration=True, encoding="utf-8") + + filepaths = [ + "./decompiled/smali_classes2/com/swiftsoft/anixartd/ui/activity/UpdateActivity.smali", + "./decompiled/smali_classes2/com/swiftsoft/anixartd/ui/fragment/main/preference/MainPreferenceFragment.smali", + ] + for filepath in filepaths: + content = "" + with open(filepath, "r", encoding="utf-8") as file: + for line in file.readlines(): + if '"\u0412\u0435\u0440\u0441\u0438\u044f'.encode("unicode_escape").decode() in line: + content += line[:line.rindex('"')] + config["version"] + line[line.rindex('"'):] + else: + content += line + with open(filepath, "w", encoding="utf-8") as file: + file.write(content) return True diff --git a/todo_drafts/todo1.txt b/todo_drafts/todo1.txt index cbf0e14..4f5b712 100644 --- a/todo_drafts/todo1.txt +++ b/todo_drafts/todo1.txt @@ -1,2 +1,27 @@ -/res/menu/bottom.xml -replace lines +/res/layout/release_info.xml + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/todo_drafts/todo2.txt b/todo_drafts/todo2.txt deleted file mode 100644 index 4f5b712..0000000 --- a/todo_drafts/todo2.txt +++ /dev/null @@ -1,27 +0,0 @@ -/res/layout/release_info.xml - - - - - - - - - - - - - - - - - - - - - - - - - -