script.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # coding:utf8
  2. __author__ = 'dong'
  3. import os
  4. import logging
  5. import xml.dom.minidom
  6. import re
  7. import shutil
  8. import glob
  9. from xml.etree.ElementTree import ElementTree, Element
  10. import distutils.dir_util
  11. from xml.etree import ElementTree as ET
  12. ANDROID_NS = 'http://schemas.android.com/apk/res/android'
  13. def script_last(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_channel_info, game_info):
  14. handle_style(extract_dir)
  15. return
  16. def handle_style(decompile_dir_path):
  17. style_xml_path = os.path.join(decompile_dir_path, 'res', 'values', 'styles.xml')
  18. xml_tree = ET.parse(style_xml_path)
  19. xml_root = xml_tree.getroot()
  20. style_roots = xml_root.findall('./style')
  21. for style_root in style_roots:
  22. if style_root.get('name') == 'AppTheme':
  23. print(style_root.get('parent'))
  24. style_root.set('parent', '@style/Theme.AppCompat.Light.NoActionBar')
  25. xml_tree.write(style_xml_path, encoding='utf-8', xml_declaration=True)
  26. break
  27. if __name__ == '__main__':
  28. d="D:/work/guanyu"
  29. handle_style(d)
  30. # replace_super_application("D:\work\wzdq")
  31. # modify_manifest("E:\\apk\\youhua\\youhua.zip.out", "requestLegacyExternalStorage")