Amazing Android How We Built Square Friday, May 14, 2010 Friday, - - PowerPoint PPT Presentation

amazing android
SMART_READER_LITE
LIVE PREVIEW

Amazing Android How We Built Square Friday, May 14, 2010 Friday, - - PowerPoint PPT Presentation

Amazing Android How We Built Square Friday, May 14, 2010 Friday, May 14, 2010 Friday, May 14, 2010 Friday, May 14, 2010 Friday, May 14, 2010 Friday, May 14, 2010 Friday, May 14, 2010 Friday, May 14, 2010 Friday, May 14, 2010 Friday, May


slide-1
SLIDE 1

Amazing Android

How We Built Square

Friday, May 14, 2010

slide-2
SLIDE 2

Friday, May 14, 2010

slide-3
SLIDE 3

Friday, May 14, 2010

slide-4
SLIDE 4

Friday, May 14, 2010

slide-5
SLIDE 5

Friday, May 14, 2010

slide-6
SLIDE 6

Friday, May 14, 2010

slide-7
SLIDE 7

Friday, May 14, 2010

slide-8
SLIDE 8

Friday, May 14, 2010

slide-9
SLIDE 9

Friday, May 14, 2010

slide-10
SLIDE 10

Friday, May 14, 2010

slide-11
SLIDE 11

Friday, May 14, 2010

slide-12
SLIDE 12

Friday, May 14, 2010

slide-13
SLIDE 13

Friday, May 14, 2010

slide-14
SLIDE 14

How We Did It

Friday, May 14, 2010

slide-15
SLIDE 15

Paper Textures

Friday, May 14, 2010

slide-16
SLIDE 16

enum Noise { GRAY(0x64676E), PAPER(0xDEDFE1), BACKGROUND(0xBCBEC2), STANDARD_BUTTON(0xcccccc), TITLE_BAR_EMPHASIZED(0x505356); private final Bitmap bitmap; Noise(int startingColor) { bitmap = Factory.newBitmap( Factory.generatePalette(startingColor)); } Bitmap getBitmap() { return bitmap; }

Friday, May 14, 2010

slide-17
SLIDE 17

/** Creates a new bitmap filled with noise. */ private static Bitmap newBitmap(int[] palette) { int[] noise = new int[SIZE]; byte[] paletteIndices = PALETTE_INDICES; for (int i = 0; i < SIZE; i++) noise[i] = palette[paletteIndices[i]]; return Bitmap.createBitmap(noise, LENGTH, LENGTH, ARGB_8888); }

Friday, May 14, 2010

slide-18
SLIDE 18

class PaperTexture extends Drawable { private Paint bitmapPaint = new Paint(); private ShapeDrawable.ShaderFactory highlight; PaperTexture(PaperColor paperColor, ShapeDrawable.ShaderFactory highlight) { bitmapPaint.setShader(new BitmapShader( paperColor.getNoise().getBitmap(), REPEAT, REPEAT)); this.highlight = highlight; } }

Friday, May 14, 2010

slide-19
SLIDE 19

public class TitleBar extends RelativeLayout { public TitleBar(Context c, AttributeSet attrs) { setBackgroundDrawable(PaperTextures.color( PaperColor.TITLE_BAR) .highlightPercentage(90).drawable()); } }

Friday, May 14, 2010

slide-20
SLIDE 20

Building Blocks

  • Bitmap
  • Paint
  • Drawable
  • Shader

Friday, May 14, 2010

slide-21
SLIDE 21

Hud

Friday, May 14, 2010

slide-22
SLIDE 22

public class Hud { public static void showImageToast( Context context, int imageResourceId) { ImageView hud = new ImageView(context); hud.setBackgroundResource(R.drawable.hud); hud.setImageResource(imageResourceId); Toast toast = new Toast(context); toast.setView(hud); toast.setDuration(Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); } }

Friday, May 14, 2010

slide-23
SLIDE 23

Numeric Keyboard

Friday, May 14, 2010

slide-24
SLIDE 24

Show Code

Friday, May 14, 2010

slide-25
SLIDE 25

IconFlipper

Friday, May 14, 2010

slide-26
SLIDE 26

IconFlipper flipper = (IconFlipper) findViewById( R.id.on_off_icon); IconFlipper.Icon onIcon = flipper.newIcon( R.drawable.on); IconFlipper.Icon offIcon = flipper.newIcon( R.drawable.off);

  • nIcon.show();

...

  • ffIcon.show(Transition.FLIP);

Using IconFlipper

Friday, May 14, 2010

slide-27
SLIDE 27

Rounded Corners Picture Frame

Friday, May 14, 2010

slide-28
SLIDE 28

Bitmap bitmap = Bitmaps.decode(fromFile(file)) .scale(imageSize) .square() .roundCorners(radius, borderWidth, borderColor) .create(resources);

Friday, May 14, 2010

slide-29
SLIDE 29

PercentageLayout

Friday, May 14, 2010

slide-30
SLIDE 30

PaymentBook

Friday, May 14, 2010

slide-31
SLIDE 31

SignatureView

Friday, May 14, 2010

slide-32
SLIDE 32

JSON

  • PaymentService

Friday, May 14, 2010

slide-33
SLIDE 33

QueueFile

  • YAFFS filesystem - Atomic segment writes

Friday, May 14, 2010