Slide 1

Slide 1 text

Fun with Rectangles Mike Castleman The Dalvik Underground April 7, 2014

Slide 2

Slide 2 text

The Problem

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

. .

Slide 5

Slide 5 text

. .

Slide 6

Slide 6 text

Solution Part 1

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

. . 5 shapes

Slide 10

Slide 10 text

. . 5 shapes top top w/red bottom middle “standalone”

Slide 11

Slide 11 text

. . 3 states

Slide 12

Slide 12 text

. . 3 states regular pressed focused

Slide 13

Slide 13 text

. . 4 resolutions

Slide 14

Slide 14 text

. . 4 resolutions mdpi hdpi xhdpi xxhdpi

Slide 15

Slide 15 text

60

Slide 16

Slide 16 text

oh no!

Slide 17

Slide 17 text

Solution Part 2

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

sizes = { mdpi: 1.0, hdpi: 1.5, xhdpi: 2.0, xxhdpi: 3.0 }

Slide 21

Slide 21 text

shapes = { standalone: [ true, true ], top: [ true, false ], top_dark: [ true, false ], bottom: [ false, true ], middle: [ false, false ] } modes = { resting: WHITE, pressed: pressed(WHITE), focused: ChunkyPNG::Color.rgb(193, 232, 247) }

Slide 22

Slide 22 text

sizes.each do |dpi, factor| shapes.each do |shape, args| # compute bounds modes.each do |maincolor| png = ChunkyPNG::Image.new(width, height, TRANSPARENT) # draw shape and 9-patch bounds! fn = File.join(File.dirname(__FILE__), "..", "res" , "drawable -#{dpi}", "venuepicker_#{shape}_#{ mode}.9.png") png.save(fn) end end end

Slide 23

Slide 23 text

full code: https://gist.github.com/mlc/10036995

Slide 24

Slide 24 text

Future Work

Slide 25

Slide 25 text

Thanks!