Slide 1

Slide 1 text

Android Workshop 02. Glass development 101 Johnny Sung

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

https://plus.google.com/+RobertWarren/posts/6EHpFkzz51v?pid=6106039615307089474&oid=113334680236721862429

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

MyGlass 連接 Google Glass

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

Glassware

Slide 8

Slide 8 text

https://developers.google.com/glass/develop/gdk/quick-start

Slide 9

Slide 9 text

http://zwallpaper.biz/hinhanh/anhto/131213sad-white-puppy-wallpaper.jpg http://techcrunch.com/2015/01/19/today-is-the-last-day-to-buy-google-glass/

Slide 10

Slide 10 text

Glass layouts

Slide 11

Slide 11 text

Text Columns Caption Title Glass layouts

Slide 12

Slide 12 text

Author Menu Alert https://developers.google.com/glass/develop/gdk/card-design Glass layouts

Slide 13

Slide 13 text

40 x 40 Screen Size: 640 x 320 Glass layouts

Slide 14

Slide 14 text

Glass layouts https://developers.google.com/glass/develop/gdk/card-design

Slide 15

Slide 15 text

Let’s move into Glass

Slide 16

Slide 16 text

https://plus.google.com/+JeffBond/posts/R83MnpKnfQq Get your hands dirty!

Slide 17

Slide 17 text

Exercise 00: Hello, World

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

AndroidManifest.xml

Slide 23

Slide 23 text

Gradle

Slide 24

Slide 24 text

voice_trigger.xml

Slide 25

Slide 25 text

VoiceTriggers.Command • add an event • calculate • call me a car • capture a panorama • check me in • check this out • control my car • control my home • explore nearby • explore the stars • find a bike • find a dentist • find a doctor • find a hospital • find a passage • find a place • find a place to stay • find a product • find a recipe • find a video • find a website • find reviews • find the exchange rate • find the price • flip a coin • give me feedback • help me sign in • keep me awake • learn an instrument • learn a song https://developers.google.com/glass/develop/gdk/reference/com/google/android/glass/app/VoiceTriggers.Command

Slide 26

Slide 26 text

MainActivity.java

Slide 27

Slide 27 text

Launch project

Slide 28

Slide 28 text

Exercise 00: Hello, World Mmm… It looks weird.

Slide 29

Slide 29 text

We can fix it!

Slide 30

Slide 30 text

AndroidManifest.xml Remove android:theme

Slide 31

Slide 31 text

Done.

Slide 32

Slide 32 text

Exercise 00: Hello, World Mmm… It’s better.

Slide 33

Slide 33 text

Immersion Example • CardBuilder • SoundEffect • CardScrollView • CardScrollAdapter • onItemClick Mmm… It’s too diffcult.

Slide 34

Slide 34 text

Code Examples http://goo.gl/LNglaz GlassWorkshop-
 Exercise00: HelloWorld

Slide 35

Slide 35 text

Exercise 01: The Whole New Hello, World

Slide 36

Slide 36 text

We can fix it!

Slide 37

Slide 37 text

Do some changes 1. Copy from android app • MainActivity.java • res/layout/activity_main.xml

Slide 38

Slide 38 text

Do some changes 2. Edit files • Change ActionBarActivity to Activity
 (MainActivity.java) • Remove android:theme
 (AndroidManifest.xml) • Remove unused padding’s var
 (activity_main.xml)

Slide 39

Slide 39 text

AndroidManifest.xml Remove android:theme

Slide 40

Slide 40 text

package com.johnny.petstarglass; import android.app.Activity; import android.os.Bundle; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.card_main); } } MainActivity.java Copy from android app’s Change this

Slide 41

Slide 41 text

Remove this Change to LinearLayout activity_main.xml

Slide 42

Slide 42 text

Done.

Slide 43

Slide 43 text

Exercise 01: The Whole New Hello, World

Slide 44

Slide 44 text

Code Examples http://goo.gl/uZLRa5 GlassWorkshop-
 Exercise01: NewHelloWorld

Slide 45

Slide 45 text

http://fc01.deviantart.net/fs9/i/2006/074/0/f/a_whole_new_world_by_fantasist.jpg

Slide 46

Slide 46 text

Exercise 03: My Voice Command

Slide 47

Slide 47 text

Using unlisted main voice commands Edit https://developers.google.com/glass/develop/gdk/voice#unlisted_commands voice_trigger.xml

Slide 48

Slide 48 text

AndroidManifest.xml Add this

Slide 49

Slide 49 text

Exercise 04: My Voice Command

Slide 50

Slide 50 text

Code Examples http://goo.gl/wsTGMN GlassWorkshop-
 Exercise02: MyVoiceCommand

Slide 51

Slide 51 text

Exercise 03: Use CardBuilder

Slide 52

Slide 52 text

View view1 = new CardBuilder(context, CardBuilder.Layout.TEXT) .setText("This is the TEXT layout. The text size will adjust dynamically.") .setFootnote("This is the footnote") .setTimestamp("just now") .getView(); CardBuilder

Slide 53

Slide 53 text

View view2 = new CardBuilder(context, CardBuilder.Layout.COLUMNS) .setText("You can even put a centered icon on a COLUMNS card instead of a mosaic.") .setFootnote("This is the footnote") .setTimestamp("just now") .setIcon(R.drawable.ic_wifi) .getView(); CardBuilder

Slide 54

Slide 54 text

public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); View view1 = new CardBuilder(this, CardBuilder.Layout.TEXT) .setText("This is the TEXT layout.") .setFootnote("footnote") .setTimestamp("just now") .getView(); setContentView(view1); } } MainActivity.java

Slide 55

Slide 55 text

Exercise 03: Use CardBuilder

Slide 56

Slide 56 text

Code Examples http://goo.gl/WdGdnR GlassWorkshop-
 Exercise03: CardBuilder

Slide 57

Slide 57 text

Additional things

Slide 58

Slide 58 text

SoundEffect AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE); am.playSoundEffect(Sounds.DISALLOWED);

Slide 59

Slide 59 text

SoundEffect https://developers.google.com/glass/develop/gdk/reference/com/google/android/glass/media/Sounds

Slide 60

Slide 60 text

Touch input Swipe down translates to KEYCODE_BACK. A camera button press
 translates to KEYCODE_CAMERA. Tap translates to KEYCODE_DPAD_CENTER.

Slide 61

Slide 61 text

Touch input @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_CAMERA) { // ... return true; } return false; } @Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_CAMERA) { // ... return true; } return false; } MainActivity.java

Slide 62

Slide 62 text

Where To Go From Here? • Check the development guide
 https://developers.google.com/glass/develop/gdk/index • Touch Gestures • Card Scroller • Slider • Live Cards

Slide 63

Slide 63 text

Q & A

Slide 64

Slide 64 text

http://fb.com/groups/glassdev.taiwan Google glass developer Taiwan 不只聊 Glass 喔