5 # assume everything needs alpha suffixes
6 for root, dirs, files in os.walk('.'):
7 if "res/drawable-" not in root: continue
10 if "_alpha.png" in before: continue
11 if not before.startswith("ic_settings_"): continue
13 after = before.replace(".png", "_alpha.png")
14 os.rename(os.path.join(root, before), os.path.join(root, after))
16 # build xml redirection
17 for root, dirs, files in os.walk('.'):
18 if "res/drawable-" not in root: continue
21 if not src.endswith(".png"): continue
24 src_clause = '\n android:src="@drawable/%s"' % (src)
26 alpha = src.endswith("_alpha")
29 alpha_clause = '\n android:tint="?android:attr/colorAccent"'
33 am = src.endswith("_am")
36 am_clause = '\n android:autoMirrored="true"'
40 with open("res/drawable/%s.xml" % (src), 'w') as xml:
41 xml.write("""<?xml version="1.0" encoding="utf-8"?>
42 <bitmap xmlns:android="http://schemas.android.com/apk/res/android"%s%s%s />
43 """ % (src_clause, alpha_clause, am_clause))