Skip to content

Instantly share code, notes, and snippets.

@rogerhu
Created July 17, 2015 07:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rogerhu/6a56ad8a02159c266531 to your computer and use it in GitHub Desktop.
Save rogerhu/6a56ad8a02159c266531 to your computer and use it in GitHub Desktop.
import os
import glob
import re
cur_dir = os.getcwd()
source_dir = "%s/projects/material-design-icons/navigation" % os.environ['HOME']
base_dest_dir = "%s/projects/my-android-project/app/src/main/res" % os.environ['HOME']
template = "drawable-%(density)s/ic_%(name)s_%(color)s_%(size)s.png"
densities = ("hdpi", "mdpi", "xhdpi", "xxhdpi", "xxxhdpi")
for density in densities:
image = template % {'name' : "arrow_drop_down",
'density': density,
'color': 'grey600',
'size': '24dp' }
source_file = os.path.join(source_dir, image)
dest_dir = os.path.join(base_dest_dir, "drawable-%s" % density)
print source_file
if os.path.exists(source_file):
print "Copying %s to %s" % (source_file, dest_dir)
os.system("cp %s %s" % (source_file, dest_dir))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment