Waiting for slices

Waiting for slices

934a9e49edc3174d09ab2e09daed5062?s=128

ymnder

May 22, 2018
Tweet

Transcript

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

  2. ࠓ೔ͷ͓඼ॻ͖ ᶃ What are Slices ᶄ Where are Slices ᶅ

    How wonderful are Slices ᶆ How install Slices 2
  3. ࠓ೔͓࿩͠ͳ͍͜ͱ • Slicesͷ಺෦࣮૷ • SliceManager: handle interactions • SliceProvider: provide

    content(ContentProvider) • SliceAction: action • SliceView: view for displaying slice • TemplateSliceBuilder: base UI builder • ͲͷΑ͏ʹSlices͕ಈ͍͍ͯΔ͔
  4. ࠓ೔ͷ͓඼ॻ͖ ᶃ What are Slices ᶄ Where are Slices ᶅ

    How wonderful are Slices ᶆ How install Slices 4
  5. What are Slices?

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

  8. ᶃWhat are Slices • templated • ๛෋ͳίϯϙʔωϯτΛ༻ҙ͍ͯ͠Δ • ࣗ෼Ͱॊೈʹ૊Έ্͛ΒΕΔ •

    interactive • ੩తͳσʔλ͚ͩͰͳ͍ • ϦΞϧλΠϜͳσʔλΛऔಘՄೳ • actionɺtoggleɺsliderɺscroll • updatable • bundled with jetpack • surfaceɺtemplatesɺcontrols(ex. text input)ͷߋ৽༧ఆ
  9. ᶃWhat are Slices • Widgetͱ͸ҧ͏ͷʁ • RemoteViewͰ࣮૷͞Ε͍ͯͳ͍ • SliceViewͱ͍͏࢓૊ΈΛ৽ͨʹ༻ҙ͍ͯ͠Δ •

    ϨΠΞ΢τ͸xmlͰͳ͘ίϯϙʔωϯτͰ૊Ή
  10. ࠓ೔ͷ͓඼ॻ͖ ᶃ What are Slices ᶄ Where are Slices ᶅ

    How wonderful are Slices ᶆ How install Slices 10
  11. ᶄWhere are Slices • Google Search App: Auto Complete •

    Google Assistant • and more…?
  12. ᶄWhere are Slices: Search App • App Name • ΞϓϦ໊ʹͻ͔͚ͬͯදࣔ͢Δ

    • permissionͱActivity΁ͷURIͷඥ෇͚͕ඞཁ
  13. ᶄWhere are Slices: Search App • General Terms • ؔ܎͢ΔΫΤϦʹ൓Ԡͤ͞Δ

    • deeplink / specific feature • FirebaseAppIndexingͰindexΛͭ͘Δ
  14. ࠓ೔ͷ͓඼ॻ͖ ᶃ What are Slices ᶄ Where are Slices ᶅ

    How wonderful are Slices ᶆ How install Slices 14
  15. ᶅHow wonderful are Slices • ϢʔβʔͷೳಈతͳߦಈʹϑοΫͰ͖Δ • ݕࡧ΍ΞγελϯτػೳͰ݁ՌΛಘΒΕͨͱ͖ • ࣗ෼ͷΞϓϦͷ֎ͰίϯςϯπʹϦʔνͰ͖Δ

    • ΞϓϦͷίΞػೳΛϛχΞϓϦͱͯ͠ఏڙͰ͖Δ • ʢ࢖ΘΕ͍ͯΔؒ͸ΞϓϦ͸ফ͞Εͳ͍ʣ
  16. ᶅHow wonderful are Slices: template • templateΛ࢖ͬͯॊೈʹUIΛ૊Έ্͛ΒΕΔ

  17. ᶅ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 ) } }
  18. ࠓ೔ͷ͓඼ॻ͖ ᶃ What are Slices ᶄ Where are Slices ᶅ

    How wonderful are Slices ᶆ How install Slices 18
  19. ᶆ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' }
  20. ᶆHow install Slices ᶃ manifestʹproviderΛఆٛ ᶄ SliceProviderΛ࣮૷ɿURIܗࣜͰ෼ذɺUIΛߏங ᶅ SliceͷUIΛߏஙɿBuilderؔ਺ ᶆ

    BroadcasrReceiverͰΠϕϯτϋϯυϦϯά • PendingIntentΛ࢖͍ɺSlices͔ΒActionΛ௨஌͢Δ • ΞϓϦͰActionΛड͚औΓߋ৽͢Δ ᶇ ࣮ػςετ • ݱঢ়Ͱ͸SliceViewerͱ͍͏DebugAppΛ࢖͏
  21. ࣍ʹԿΛ͢Δ͔ • Code labΛ΍Δ • Slicesͷ࣮૷աఔΛҰ௨Γֶ΂Δ • DocumentΛಡΉ • templateͷ૊ΈํͳͲ͕ॆ࣮͍ͯ͠Δ

    • App ActionsΛֶͿ • ActionsΛػೳڧԽ͢ΔͨΊͷ࢓૊Έͱͯ͠ͷSlices • ಺෦࣮૷ΛಡΉ • ͨʔʔʔͷ͠ʔʔʔʔɿϒϩάॻ͔ͳ͖Ό
  22. ࢀߟϦϯΫ • 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
  23. whoami • twitter:@ymnd, github:@ymnder • Application Engineer • Android ೔ܦిࢠ൛ΞϓϦ

    • Android ࢴ໘ϏϡʔΞʔΞϓϦ • ٕज़ϒϩά΍ͬͯ·͢ → https://hack.nikkei.com/blog/ 23
  24. Slices΍͍͖ͬͯ