マテリアル・デザインのアイコンセットを使いやすい配置に変える

たくさんの画像リソースが公開されています.

Material_Icons_Index

【使える! 即保存】 github で公開されている Material design icons 一覧

どれもいいかんじです.

で, これ一覧で好きなアイコンを選んだあと,

zipをダウンロード/展開したあとどれを使ったらいいのか.

たとえば, 一覧で「error」アイコンを使おうとすると

こんなにある.

./alert/drawable-hdpi/ic_error_black_18dp.png
./alert/drawable-hdpi/ic_error_black_24dp.png
./alert/drawable-hdpi/ic_error_black_36dp.png
./alert/drawable-hdpi/ic_error_black_48dp.png
./alert/drawable-hdpi/ic_error_grey600_18dp.png
...(略)...
./alert/drawable-xxxhdpi/ic_error_red_48dp.png
./alert/drawable-xxxhdpi/ic_error_white_18dp.png
./alert/drawable-xxxhdpi/ic_error_white_24dp.png
./alert/drawable-xxxhdpi/ic_error_white_36dp.png
./alert/drawable-xxxhdpi/ic_error_white_48dp.png

ディレクトリの構造はこんなかんじになってる.

material-design-icons-master
├── action
│   ├── drawable-hdpi
│   │   ├── ic_error_red_18dp.png
│   │   ├── ic_error_red_24dp.png
│   │   ├── ic_error_red_36dp.png
│   │   ├── ic_error_red_48dp.png
│   ├── drawable-mdpi
│   ├── drawable-xhdpi
│   ├── drawable-xxhdpi
│   ├── drawable-xxxhdpi

アイコンファイルを選択する他に

いくつか決めなければならないことがあったりします.

・dpi
・color
・dip

「色」は見て決めれるけども...

以下を見ながら, dip(サイズ/スケール) と

対象ファイル, 新しいファイル名を決める.

Launcher ic_launcher_***.png 48dp
Action Bar ic_menu_***.png 32dp
Small/Contextual ic_***.png 16dp
Notification ic_stat_notify_***.png 24dp

Iconography | Android Developers

細かくいろいろ区別できるのだろうけど,

Android Studioのプロジェクトデフォルトdpiの構成に

drawableディレクトリはとりあえず合わせよう.

res
├── drawable-hdpi
│   └── ic_error.png
├── drawable-mdpi
│   └── ic_error.png
├── drawable-xhdpi
│   └── ic_error.png
├── drawable-xxhdpi
│   └── ic_error.png

などとシコシコ手動でやってみたがめんどうなので

zip の展開後のディレクトリ構成とファイル名を

あらかじめ変更しておけば, フォルダごと上書きできそうなので

一括でスクリプトで以下に変更しておく.

{category}/drawable-{dpi}/ic_{name}_{color}_{dip}.png

{category}/{name}/{color}/{dip}/drawable-{dpi}/ic_{name}.png

<?php
/**
 Restructure dirs/files tree.
 
https://github.com/google/material-design-icons
 
Usage:
 
$ curl -LO https://github.com/google/material-design-icons/archive/master.zip
$ unzip material-design-icons-master.zip
$ ls
... material-design-icons-master ... 
$ php restructure.php
 
{category}/drawable-{dpi}/ic_{name}_{color}_{dip}.png
-> {category}/{name}/{color}/{dip}/drawable-{dpi}/ic_{name}.png
 
 
~/material-design-icons-master_new $ tree . 
.
├── action
│   ├── 3d_rotation
│   │   ├── black
│   │   │   ├── 18dp
│   │   │   │   ├── drawable-hdpi
│   │   │   │   │   └── ic_3d_rotation.png
│   │   │   │   ├── drawable-mdpi
│   │   │   │   │   └── ic_3d_rotation.png
│   │   │   │   ├── drawable-xhdpi
│   │   │   │   │   └── ic_3d_rotation.png
│   │   │   │   ├── drawable-xxhdpi
│   │   │   │   │   └── ic_3d_rotation.png
│   │   │   │   └── drawable-xxxhdpi
│   │   │   │       └── ic_3d_rotation.png
│   │   │   ├── 24dp
│   │   │   │   ├── drawable-hdpi
│   │   │   │   │   └── ic_3d_rotation.png
│   │   │   │   ├── drawable-mdpi
│   │   │   │   │   └── ic_3d_rotation.png
...
*/
 
foreach (glob('material-design-icons-master/*/*/*.png') as $file) {
  if (is_file($file) && preg_match('@/drawable@', $file)) {
    $path_parts = pathinfo($file);
    $filename = $path_parts['filename'];
    $dirs = explode('/', $path_parts['dirname']);
    $category   = $dirs[1];
    $dip        = substr($filename, strrpos($filename, '_') + 1);
    $dpi        = substr($dirs[2], strpos($dirs[2], '-') + 1);
    $filename   = substr($filename, 0, strpos($filename, '_' . $dip));
    $name_color = substr($filename, strpos($filename, '_') + 1);
    $color      = substr($name_color, strrpos($name_color, '_') + 1);
    $name       = substr($name_color, 0, strpos($name_color, '_' . $color));
    $path = sprintf('%s_new/%s/%s/%s/%s/drawable-%s/ic_%s.png',
                    $dirs[0], $category, $name, $color, $dip, $dpi, $name);
    mkdir(dirname($path), 0777, true);
    copy($file, $path);
    echo $file . "\n";
    echo '-> ' . $path . "\n";
  }
}

ディレクトリ構成を変更 - gist

構成変更後はこんなかんじに.

~/material-design-icons-master_new $ tree . 
.
├── action
│   ├── 3d_rotation
│   │   ├── black
│   │   │   ├── 18dp
│   │   │   │   ├── drawable-hdpi
│   │   │   │   │   └── ic_3d_rotation.png
│   │   │   │   ├── drawable-mdpi
│   │   │   │   │   └── ic_3d_rotation.png
│   │   │   │   ├── drawable-xhdpi
│   │   │   │   │   └── ic_3d_rotation.png
│   │   │   │   ├── drawable-xxhdpi
│   │   │   │   │   └── ic_3d_rotation.png
│   │   │   │   └── drawable-xxxhdpi
│   │   │   │       └── ic_3d_rotation.png
│   │   │   ├── 24dp
│   │   │   │   ├── drawable-hdpi
│   │   │   │   │   └── ic_3d_rotation.png
│   │   │   │   ├── drawable-mdpi
│   │   │   │   │   └── ic_3d_rotation.png
...

こうしておけば,

使いたいアイコンの色, 利用場所(dip) を考えながら,

GUI上でディレクトリごと上書きで,

IDE上の res ディレクトリ以下にコピーすればよい.

icon_copy

よくみると, IDE側の drawable-*** のディレクトリ名は微妙に違ってたりするが(笑)


【使える! 即保存】 github で公開されている Material design icons 一覧

今, 話題の「Material Design」.

アイコンリソースが公開されています.

google/material-design-icons

いちいち zip ダウンロードして眺めるのもなんなので,

一覧にしておく.

action


3d rotation

accessibility

account balance

account balance wallet

account box

account child

account circle

add shopping cart

alarm

alarm add

alarm off

alarm on

android

announcement

aspect ratio

assessment

assignment

assignment ind

assignment late

assignment return

assignment returned

assignment turned in

autorenew

backup

book

bookmark

bookmark outline

bug report

cached

class

credit card

dashboard

delete

description

dns

done

done all

event

exit to app

explore

extension

face unlock

favorite

favorite outline

find in page

find replace

flip to back

flip to front

get app

grade

group work

help

highlight remove

history

home

https

info

info outline

input

invert colors

label

label outline

language

launch

list

lock

lock open

lock outline

loyalty

markunread mailbox

note add

open in browser

open in new

open with

pageview

payment

perm camera mic

perm contact cal

perm data setting

perm device info

perm identity

perm media

perm phone msg

perm scan wifi

picture in picture

polymer

print

query builder

question answer

receipt

redeem

reorder

report problem

restore

room

schedule

search

settings

settings applications

settings backup restore

settings bluetooth

settings cell

settings display

settings ethernet

settings input antenna

settings input component

settings input composite

settings input hdmi

settings input svideo

settings overscan

settings phone

settings power

settings remote

settings voice

shop

shop two

shopping basket

shopping cart

speaker notes

spellcheck

star rate

stars

store

subject

supervisor account

swap horiz

swap vert

swap vert circle

system update tv

tab

tab unselected

theaters

thumb down

thumb up

thumbs up down

toc

today

track changes

translate

trending down

trending neutral

trending up

turned in

turned in not

verified user

view agenda

view array

view carousel

view column

view day

view headline

view list

view module

view quilt

view stream

view week

visibility

visibility off

wallet giftcard

wallet membership

wallet travel

work

alert


error

warning

av


album

av timer

closed caption

equalizer

explicit

fast forward

fast rewind

games

hearing

high quality

loop

mic

mic none

mic off

movie

my library add

my library books

my library music

new releases

not interested

pause

pause circle fill

pause circle outline

play arrow

play circle fill

play circle outline

play shopping bag

playlist add

queue

queue music

radio

recent actors

repeat

repeat one

replay

shuffle

skip next

skip previous

snooze

stop

subtitles

surround sound

video collection

videocam

videocam off

volume down

volume mute

volume off

volume up

web

communication


business

call

call end

call made

call merge

call missed

call received

call split

chat

clear all

comment

contacts

dialer sip

dialpad

dnd on

email

forum

import export

invert colors off

invert colors on

live help

location off

location on

message

messenger

no sim

phone

portable wifi off

quick contacts dialer

quick contacts mail

ring volume

stay current landscape

stay current portrait

stay primary landscape

stay primary portrait

swap calls

textsms

voicemail

vpn key

content


add

add box

add circle

add circle outline

archive

backspace

block

clear

content copy

content cut

content paste

create

drafts

filter list

flag

forward

gesture

inbox

link

mail

markunread

redo

remove

remove circle

remove circle outline

reply

reply all

report

save

select all

send

sort

text format

undo

device


access alarm

access alarms

access time

add alarm

airplanemode off

airplanemode on

battery 20

battery 30

battery 50

battery 60

battery 80

battery 90

battery alert

battery charging 20

battery charging 30

battery charging 50

battery charging 60

battery charging 80

battery charging 90

battery charging full

battery full

battery std

battery unknown

bluetooth

bluetooth connected

bluetooth disabled

bluetooth searching

brightness auto

brightness high

brightness low

brightness medium

data usage

developer mode

devices

dvr

gps fixed

gps not fixed

gps off

location disabled

location searching

multitrack audio

network cell

network wifi

nfc

now wallpaper

now widgets

screen lock landscape

screen lock portrait

screen lock rotation

screen rotation

sd storage

settings system daydream

signal cellular 0 bar

signal cellular 1 bar

signal cellular 2 bar

signal cellular 3 bar

signal cellular 4 bar

signal cellular connected no internet 0 bar

signal cellular connected no internet 1 bar

signal cellular connected no internet 2 bar

signal cellular connected no internet 3 bar

signal cellular connected no internet 4 bar

signal cellular no sim

signal cellular null

signal cellular off

signal wifi 0 bar

signal wifi 1 bar

signal wifi 2 bar

signal wifi 3 bar

signal wifi 4 bar

signal wifi off

signal wifi statusbar 1 bar

signal wifi statusbar 2 bar

signal wifi statusbar 3 bar

signal wifi statusbar 4 bar

signal wifi statusbar connected no internet 1

signal wifi statusbar connected no internet

signal wifi statusbar connected no internet 2

signal wifi statusbar connected no internet 3

signal wifi statusbar connected no internet 4

signal wifi statusbar not connected

signal wifi statusbar null

storage

usb

wifi lock

wifi tethering

editor


attach file

attach money

border all

border bottom

border clear

border color

border horizontal

border inner

border left

border outer

border right

border style

border top

border vertical

format align center

format align justify

format align left

format align right

format bold

format clear

format color fill

format color reset

format color text

format indent decrease

format indent increase

format italic

format line spacing

format list bulleted

format list numbered

format paint

format quote

format size

format strikethrough

format textdirection l to r

format textdirection r to l

format underline

functions

insert chart

insert comment

insert drive file

insert emoticon

insert invitation

insert link

insert photo

merge type

mode comment

mode edit

publish

vertical align bottom

vertical align center

vertical align top

wrap text

file


attachment

cloud

cloud circle

cloud done

cloud download

cloud off

cloud queue

cloud upload

file download

file upload

folder

folder open

folder shared

hardware


cast

cast connected

computer

desktop mac

desktop windows

dock

gamepad

headset

headset mic

keyboard

keyboard alt

keyboard arrow down

keyboard arrow left

keyboard arrow right

keyboard arrow up

keyboard backspace

keyboard capslock

keyboard control

keyboard hide

keyboard return

keyboard tab

keyboard voice

laptop

laptop chromebook

laptop mac

laptop windows

memory

mouse

phone android

phone iphone

phonelink

phonelink off

security

sim card

smartphone

speaker

tablet

tablet android

tablet mac

tv

watch

image


add to photos

adjust

assistant photo

audiotrack

blur circular

blur linear

blur off

blur on

brightness 1

brightness 2

brightness 3

brightness 4

brightness 5

brightness 6

brightness 7

brush

camera

camera alt

camera front

camera rear

camera roll

center focus strong

center focus weak

collections

color lens

colorize

compare

control point

control point duplicate

crop 16 9

crop

crop 3 2

crop 5 4

crop 7 5

crop din

crop free

crop landscape

crop original

crop portrait

crop square

dehaze

details

edit

exposure

exposure minus 1

exposure minus 2

exposure plus 1

exposure plus 2

exposure zero

filter 1

filter

filter 2

filter 3

filter 4

filter 5

filter 6

filter 7

filter 8

filter 9

filter 9 plus

filter b and w

filter center focus

filter drama

filter frames

filter hdr

filter none

filter tilt shift

filter vintage

flare

flash auto

flash off

flash on

flip

gradient

grain

grid off

grid on

hdr off

hdr on

hdr strong

hdr weak

healing

image

image aspect ratio

iso

landscape

leak add

leak remove

lens

looks

looks 3

looks 4

looks 5

looks 6

looks one

looks two

loupe

movie creation

nature

nature people

navigate before

navigate next

palette

panorama

panorama fisheye

panorama horizontal

panorama vertical

panorama wide angle

photo

photo album

photo camera

photo library

portrait

remove red eye

rotate left

rotate right

slideshow

straighten

style

switch camera

switch video

tag faces

texture

timelapse

timer 10

timer

timer 3

timer auto

timer off

tonality

transform

tune

wb auto

wb cloudy

wb incandescent

wb irradescent

wb sunny

maps


beenhere

directions

directions bike

directions bus

directions car

directions ferry

directions subway

directions train

directions transit

directions walk

flight

hotel

layers

layers clear

local airport

local atm

local attraction

local bar

local cafe

local car wash

local convenience store

local drink

local florist

local gas station

local grocery store

local hospital

local hotel

local laundry service

local library

local mall

local movies

local offer

local parking

local pharmacy

local phone

local pizza

local play

local post office

local print shop

local restaurant

local see

local shipping

local taxi

location history

map

my location

navigation

pin drop

place

rate review

restaurant menu

satellite

store mall directory

terrain

traffic

navigation


apps

arrow back

arrow drop down

arrow drop down circle

arrow drop up

arrow forward

cancel

check

chevron left

chevron right

close

expand less

expand more

fullscreen

fullscreen exit

menu

more horiz

more vert

refresh

unfold less

unfold more

notification


adb

bluetooth audio

disc full

dnd forwardslash

do not disturb

drive eta

event available

event busy

event note

folder special

mms

more

network locked

phone bluetooth speaker

phone forwarded

phone in talk

phone locked

phone missed

phone paused

play download

play install

sd card

sim card alert

sms

sms failed

sync

sync disabled

sync problem

system update

tap and play

time to leave

vibration

voice chat

vpn lock

social


cake

domain

group

group add

location city

mood

notifications

notifications none

notifications off

notifications on

notifications paused

pages

party mode

people

people outline

person

person add

person outline

plus one

poll

public

school

share

whatshot

toggle


check box

check box outline blank

radio button off

radio button on

star

star half

star outline

同梱物は以下のようです.

SVG versions of all icons in both 24px and 48px flavours
SVG and CSS sprites of all icons
1x, 2x icons targeted at the Web (PNG)
1x, 2x, 3x icons targeted at iOS (PNG)
Hi-dpi versions of all icons (hdpi, mdpi, xhdpi, xxhdpi, xxxhdpi) (PNG)

あっ..