6 # assume everything needs alpha suffixes
7 for root, dirs, files in os.walk('.'):
8 if "res/drawable-" not in root: continue
11 if "_alpha.png" in before: continue
13 after = before.replace(".png", "_alpha.png")
14 os.rename(os.path.join(root, before), os.path.join(root, after))
17 # build xml redirection
18 for root, dirs, files in os.walk('.'):
19 if "res/drawable-" not in root: continue
22 if not src.endswith(".png"): continue
25 src_clause = '\n android:src="@drawable/%s"' % (src)
27 alpha = src.endswith("_alpha")
30 if "ic_doc" in src or "ic_root" in src or "ic_grid_folder" in src:
31 alpha_clause = '\n android:tint="@*android:color/secondary_text_material_light"'
33 alpha_clause = '\n android:tint="?android:attr/colorControlNormal"'
37 am = src.endswith("_am")
40 am_clause = '\n android:autoMirrored="true"'
44 with open("res/drawable/%s.xml" % (src), 'w') as xml:
45 xml.write("""<?xml version="1.0" encoding="utf-8"?>
46 <bitmap xmlns:android="http://schemas.android.com/apk/res/android"%s%s%s />
47 """ % (src_clause, alpha_clause, am_clause))