| # assume everything needs alpha suffixes |
| for root, dirs, files in os.walk('.'): |
| if "res/drawable-" not in root: continue |
| if "_alpha.png" in before: continue |
| if not before.startswith("ic_settings_"): continue |
| after = before.replace(".png", "_alpha.png") |
| os.rename(os.path.join(root, before), os.path.join(root, after)) |
| for root, dirs, files in os.walk('.'): |
| if "res/drawable-" not in root: continue |
| if not src.endswith(".png"): continue |
| src_clause = '\n android:src="@drawable/%s"' % (src) |
| alpha = src.endswith("_alpha") |
| alpha_clause = '\n android:tint="?android:attr/colorAccent"' |
| am_clause = '\n android:autoMirrored="true"' |
| with open("res/drawable/%s.xml" % (src), 'w') as xml: |
| xml.write("""<?xml version="1.0" encoding="utf-8"?> |
| <bitmap xmlns:android="http://schemas.android.com/apk/res/android"%s%s%s /> |
| """ % (src_clause, alpha_clause, am_clause)) |