Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Waiting for slices

Waiting for slices

ymnder

May 22, 2018
Tweet

More Decks by ymnder

Other Decks in Programming

Transcript

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

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

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

    How wonderful are Slices ᶆ How install Slices 4
  4. 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.
  5. ᶃWhat are Slices • templated • ๛෋ͳίϯϙʔωϯτΛ༻ҙ͍ͯ͠Δ • ࣗ෼Ͱॊೈʹ૊Έ্͛ΒΕΔ •

    interactive • ੩తͳσʔλ͚ͩͰͳ͍ • ϦΞϧλΠϜͳσʔλΛऔಘՄೳ • actionɺtoggleɺsliderɺscroll • updatable • bundled with jetpack • surfaceɺtemplatesɺcontrols(ex. text input)ͷߋ৽༧ఆ
  6. ࠓ೔ͷ͓඼ॻ͖ ᶃ What are Slices ᶄ Where are Slices ᶅ

    How wonderful are Slices ᶆ How install Slices 10
  7. ᶄWhere are Slices: Search App • General Terms • ؔ܎͢ΔΫΤϦʹ൓Ԡͤ͞Δ

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

    How wonderful are Slices ᶆ How install Slices 14
  9. ᶅ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 ) } }
  10. ࠓ೔ͷ͓඼ॻ͖ ᶃ What are Slices ᶄ Where are Slices ᶅ

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

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

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

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