Slide 1

Slide 1 text

Waiting for slices CA.apk#6 @Shibuya 2018/05/22 @ymnd

Slide 2

Slide 2 text

ࠓ೔ͷ͓඼ॻ͖ ᶃ What are Slices ᶄ Where are Slices ᶅ How wonderful are Slices ᶆ How install Slices 2

Slide 3

Slide 3 text

ࠓ೔͓࿩͠ͳ͍͜ͱ • Slicesͷ಺෦࣮૷ • SliceManager: handle interactions • SliceProvider: provide content(ContentProvider) • SliceAction: action • SliceView: view for displaying slice • TemplateSliceBuilder: base UI builder • ͲͷΑ͏ʹSlices͕ಈ͍͍ͯΔ͔

Slide 4

Slide 4 text

ࠓ೔ͷ͓඼ॻ͖ ᶃ What are Slices ᶄ Where are Slices ᶅ How wonderful are Slices ᶆ How install Slices 4

Slide 5

Slide 5 text

What are Slices?

Slide 6

Slide 6 text

Slices are UI templates that can display rich, dynamic, and interactive content from your app from within the Google Search app and later in other places like the Google Assistant.

Slide 7

Slide 7 text

ᶃWhat are Slices • remotableͰcontrolableͳૢ࡞Λఏڙ͢Δinline UI • ϦϞʔτίϯςϯπʹର͢Δ৽͍͠Ξϓϩʔν • ଞͷΞϓϦʹϛχΞϓϦΛࠩ͠ࠐΊΔΠϝʔδ

Slide 8

Slide 8 text

ᶃWhat are Slices • templated • ๛෋ͳίϯϙʔωϯτΛ༻ҙ͍ͯ͠Δ • ࣗ෼Ͱॊೈʹ૊Έ্͛ΒΕΔ • interactive • ੩తͳσʔλ͚ͩͰͳ͍ • ϦΞϧλΠϜͳσʔλΛऔಘՄೳ • actionɺtoggleɺsliderɺscroll • updatable • bundled with jetpack • surfaceɺtemplatesɺcontrols(ex. text input)ͷߋ৽༧ఆ

Slide 9

Slide 9 text

ᶃWhat are Slices • Widgetͱ͸ҧ͏ͷʁ • RemoteViewͰ࣮૷͞Ε͍ͯͳ͍ • SliceViewͱ͍͏࢓૊ΈΛ৽ͨʹ༻ҙ͍ͯ͠Δ • ϨΠΞ΢τ͸xmlͰͳ͘ίϯϙʔωϯτͰ૊Ή

Slide 10

Slide 10 text

ࠓ೔ͷ͓඼ॻ͖ ᶃ What are Slices ᶄ Where are Slices ᶅ How wonderful are Slices ᶆ How install Slices 10

Slide 11

Slide 11 text

ᶄWhere are Slices • Google Search App: Auto Complete • Google Assistant • and more…?

Slide 12

Slide 12 text

ᶄWhere are Slices: Search App • App Name • ΞϓϦ໊ʹͻ͔͚ͬͯදࣔ͢Δ • permissionͱActivity΁ͷURIͷඥ෇͚͕ඞཁ

Slide 13

Slide 13 text

ᶄWhere are Slices: Search App • General Terms • ؔ܎͢ΔΫΤϦʹ൓Ԡͤ͞Δ • deeplink / specific feature • FirebaseAppIndexingͰindexΛͭ͘Δ

Slide 14

Slide 14 text

ࠓ೔ͷ͓඼ॻ͖ ᶃ What are Slices ᶄ Where are Slices ᶅ How wonderful are Slices ᶆ How install Slices 14

Slide 15

Slide 15 text

ᶅHow wonderful are Slices • ϢʔβʔͷೳಈతͳߦಈʹϑοΫͰ͖Δ • ݕࡧ΍ΞγελϯτػೳͰ݁ՌΛಘΒΕͨͱ͖ • ࣗ෼ͷΞϓϦͷ֎ͰίϯςϯπʹϦʔνͰ͖Δ • ΞϓϦͷίΞػೳΛϛχΞϓϦͱͯ͠ఏڙͰ͖Δ • ʢ࢖ΘΕ͍ͯΔؒ͸ΞϓϦ͸ফ͞Εͳ͍ʣ

Slide 16

Slide 16 text

ᶅHow wonderful are Slices: template • templateΛ࢖ͬͯॊೈʹUIΛ૊Έ্͛ΒΕΔ

Slide 17

Slide 17 text

ᶅHow wonderful are Slices: template • fun createSliceWithHeader(sliceUri: Uri) = ListBuilder(context, sliceUri, ListBuilder.INFINITY) .setAccentColor(0xff0F9D) // Specify color for tinting icons .setHeader { it.apply { setTitle("Get a ride") setSubtitle("Ride in 4 min") setSummary("Work in 1 hour 45 min | Home in 12 min") } }.addRow { it.apply { setTitle("Home") setSubtitle("12 miles | 12 min | $9.00") addEndItem( IconCompat.createWithResource(context, R.drawable.ic_home), SliceHints.ICON_IMAGE ) } }

Slide 18

Slide 18 text

ࠓ೔ͷ͓඼ॻ͖ ᶃ What are Slices ᶄ Where are Slices ᶅ How wonderful are Slices ᶆ How install Slices 18

Slide 19

Slide 19 text

ᶆHow install Slices • minSdk is 19+!!!!! • gradleʹ͸ҎԼΛهड़ʢα൛Ͱ͢ʣ dependencies { implementation 'androidx.slice:slice-core:1.0.0-alpha1' implementation 'androidx.slice:slice-builders:1.0.0-alpha1' implementation 'androidx.slice:slice-view:1.0.0-alpha1' }

Slide 20

Slide 20 text

ᶆHow install Slices ᶃ manifestʹproviderΛఆٛ ᶄ SliceProviderΛ࣮૷ɿURIܗࣜͰ෼ذɺUIΛߏங ᶅ SliceͷUIΛߏஙɿBuilderؔ਺ ᶆ BroadcasrReceiverͰΠϕϯτϋϯυϦϯά • PendingIntentΛ࢖͍ɺSlices͔ΒActionΛ௨஌͢Δ • ΞϓϦͰActionΛड͚औΓߋ৽͢Δ ᶇ ࣮ػςετ • ݱঢ়Ͱ͸SliceViewerͱ͍͏DebugAppΛ࢖͏

Slide 21

Slide 21 text

࣍ʹԿΛ͢Δ͔ • Code labΛ΍Δ • Slicesͷ࣮૷աఔΛҰ௨Γֶ΂Δ • DocumentΛಡΉ • templateͷ૊ΈํͳͲ͕ॆ࣮͍ͯ͠Δ • App ActionsΛֶͿ • ActionsΛػೳڧԽ͢ΔͨΊͷ࢓૊Έͱͯ͠ͷSlices • ಺෦࣮૷ΛಡΉ • ͨʔʔʔͷ͠ʔʔʔʔɿϒϩάॻ͔ͳ͖Ό

Slide 22

Slide 22 text

ࢀߟϦϯΫ • http://g.co/Slices • https://codelabs.developers.google.com/codelabs/android- slices-basic/index.html?index=..%2F..%2Findex#0 • https://blog.novoda.com/android-p-slices-missing- documentation-part-1/ • https://techblog.picappinc.jp/google-i- o%E3%81%A7%E3%83%86%E3%83%B3%E3%82%B7%E3%8 3%A7%E3%83%B3%E4%B8%8A%E3%81%8C%E3%81%A3% E3%81%9Fslices%E3%81%AE%E8%A9%B1-4425de150b7b • http://konifar-zatsu.hatenadiary.jp/entry/2018/05/16/155727

Slide 23

Slide 23 text

whoami • twitter:@ymnd, github:@ymnder • Application Engineer • Android ೔ܦిࢠ൛ΞϓϦ • Android ࢴ໘ϏϡʔΞʔΞϓϦ • ٕज़ϒϩά΍ͬͯ·͢ → https://hack.nikkei.com/blog/ 23

Slide 24

Slide 24 text

Slices΍͍͖ͬͯ