Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Now in Android Overview
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
aosa4054
July 08, 2022
Programming
1.5k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Now in Android Overview
社内LT会で使用した資料です。
aosa4054
July 08, 2022
More Decks by aosa4054
See All by aosa4054
LazyVerticalGridに学ぶ 非スクローラブルなグリッドの作り方
aosa4054
0
810
実用 Picture in Picture
aosa4054
2
940
自作アプリのアイコンを作った話
aosa4054
0
260
Other Decks in Programming
See All in Programming
クラウドエージェントは、 何がそんなに便利なのか / what makes cloud agents so useful
rkaga
3
550
エージェントを使い続けるためのメタワーク / Meta-work for keeping using the agent
rkaga
6
1.9k
graphql-ruby を Spinel で速くしようとした話
mtsmfm
0
120
Next.js: The final boss of Web Performance
guaca
0
340
phperだってパンチカードでコーディングしたい
o0h
PRO
0
460
Jetpack Compose Mechanisms
skydoves
3
870
現場と育てるRailsモデリング 〜Spreadsheetから始めたモデル設計〜
siroemk
2
960
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
Kotlinize Is Not Just Converting to Kotlin
chigichan24
1
190
Modernizing iOS Apps
seyfoyun
0
120
Event is what happens
moro
2
1.6k
AI時代のTerminal環境を UNIX哲学で設計・運用する
yasunori0418
1
240
Featured
See All Featured
The Mindset for Success: Future Career Progression
greggifford
PRO
0
550
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
580
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1.1k
Unsuck your backbone
ammeep
672
58k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
Everyday Curiosity
cassininazir
0
360
KATA
mclloyd
PRO
35
16k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.5k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.1k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
550
How to train your dragon (web standard)
notwaldorf
96
6.9k
Transcript
Now in Android Overview ࣾGoogle I/O LTձ 2022/06/24 Shota Ara
Index • What is “Now in Android” • Architecture Overview
• Feature of “Now in Android” • Links
What is “Now in Android”
What is “Now in Android” • ઃܭʢσβΠϯʁʣɺ։ൃͷϕετ ϓϥΫςΟεΛ࠾༻ͨ͠ࢀߟΞϓϦ • ϑϧKotlin
/ Jetpack Compose • Androidͷχϡʔε͕ݟΕΔ • is not yet available on the Play Store
Architecture Overview
Architecture Overview MVVM Architecture with Flow • MVVM + Repository
• Room, DataStoreͷFlow IFΛ༻ • APIΞΫηεΞϓϦىಈ࣌ͷΈ • ىಈதΩϟογϡΛ༻ • ViewModelͰՃͨ͠FlowΛ ViewͰcollectAsStateͰߪಡ 6
ViewModel /* ؆୯ͷͨΊʹॾʑলུͯ͠·͢ɻ */ class ForYouViewModel { private val followedInterestsState:
StateFlow = repository.userDataStream .map { /* Ճ */ } .stateIn(/* ॳظείʔϓͳͲ */) val feedState: StateFlow = combine( followedInterestsState, /* ͦͷଞͷRepositoryΞΫηεͳͲ */ ) { /* * - combineͷ֤ཁૉ͕ඞཁͳॲཧ * - UiStateܕʹม */ } } RepositoryͷΛऔಘɾ Ճͯ͠ViewʹStateFlowΛ ެ։͢Δɻ
ViewModel /* ؆୯ͷͨΊʹॾʑলུͯ͠·͢ɻ */ class ForYouViewModel { private val followedInterestsState:
StateFlow = repository.userDataStream .map { /* Ճ */ } .stateIn(/* ॳظείʔϓͳͲ */) val feedState: StateFlow = combine( followedInterestsState, /* ͦͷଞͷRepositoryΞΫηεͳͲ */ ) { /* * - combineͷ֤ཁૉ͕ඞཁͳॲཧ * - UiStateܕʹม */ } } RepositoryͷΛऔಘɺ Ճ͠StateFlowʹม͢Δ ϦϙδτϦͷฦΓΛΞϓϦͷ υϝΠϯͷܕʹม
/* ؆୯ͷͨΊʹॾʑলུͯ͠·͢ɻ */ class ForYouViewModel { private val followedInterestsState: StateFlow
= repository.userDataStream .map { /* Ճ */ } .stateIn(/* ॳظείʔϓͳͲ */) val feedState: StateFlow = combine( followedInterestsState, /* ͦͷଞͷRepositoryΞΫηεͳͲ */ ) { /* * - combineͷ֤ཁૉ͕ඞཁͳॲཧ * - UiStateܕʹม */ } } ViewModel ෳͷFlow͔ΒҰͭͷ UiStateΛΈཱͯΔ
Feature of “Now in Android”
Feature of “Now in Android” App Startup •ΞϓϦͷىಈ࣌ʹॳظԽ͢Δඞཁ ͷ͋ΔϥΠϒϥϦͰɺͦͷॳظ ԽʹcontentProvider͕༻͍ΒΕΔ
͜ͱ͕͋Δ •ͦΕʹΑͬͯىಈ͕͘ͳΒͳ͍ ͨΊʹcontentProviderͷ੍ޚΛߦ ͳͬͯ͘ΕΔϥΠϒϥϦ 11
Feature of “Now in Android” App Startup in Now
in Android app •NiAΞϓϦ্Ͱςετͷ߹্ ཧతͳ͍ํʹͳ͍ͬͯͳ͍ •WorkerΛॳظԽ͠ɺWorkerʹ ΑͬͯAPIίʔϧΛߦͳ͍ͬͯΔ •ϨεϙϯεશͯϩʔΧϧʹ Ωϟογϡ͞ΕΔ 12
WindowSizeClass ը໘αΠζʹԠͯ͡දࣔ͢ΔUIΛ ม͍͑ͯΔɻ • BottomBar -> NavRail • χϡʔεͷΧϥϜ
WindowSizeClass Scaffold( /* ΖΖ */ bottomBar = { if (windowSizeClass.widthSizeClass
== WindowWidthSizeClass.Compat) { NiaBottomBar(/* ΖΖ */) } } ) { Row(/* ΖΖ */) { if (windowSizeClass.widthSizeClass != WindowWidthSizeClass.Compact) { NiaNavRail(/* ΖΖ */) } /* Viewͷίϯςϯπ */ } }
WindowSizeClass Scaffold( /* ΖΖ */ bottomBar = { if (windowSizeClass.widthSizeClass
== WindowWidthSizeClass.Compat) { NiaBottomBar(/* ΖΖ */) } } ) { Row(/* ΖΖ */) { if (windowSizeClass.widthSizeClass != WindowWidthSizeClass.Compact) { NiaNavRail(/* ΖΖ */) } /* Viewͷίϯςϯπ */ } } Material designͷجຊతͳߏΛ ࣮͍ͯ͠ΔComposable
WindowSizeClass Scaffold( /* ΖΖ */ bottomBar = { if (windowSizeClass.widthSizeClass
== WindowWidthSizeClass.Compat) { NiaBottomBar(/* ΖΖ */) } } ) { Row(/* ΖΖ */) { if (windowSizeClass.widthSizeClass != WindowWidthSizeClass.Compact) { NiaNavRail(/* ΖΖ */) } /* Viewͷίϯςϯπ */ } } Material 3ͰActivityΛҾͱͨ͠ τοϓϨϕϧ͔ؔΒऔಘͰ͖Δ
WindowSize Scaffold( /* ΖΖ */ bottomBar = { if (windowSizeClass.widthSizeClass
== WindowWidthSizeClass.Compat) { NiaBottomBar(/* ΖΖ */) } } ) { Row(/* ΖΖ */) { if (windowSizeClass.widthSizeClass != WindowWidthSizeClass.Compact) { NiaNavRail(/* ΖΖ */) } /* Viewͷίϯςϯπ */ } }
Links
Links • ϦϙδτϦ https://github.com/android/nowinandroid • հ͞Ε͍ͯΔAndroid Developers Blog
https://android-developers.googleblog.com/2022/05/now-in- android-sample-app-alpha.html • Now in Android ΞϓϦղઆ by yanzm͞Μ https://speakerdeck.com/yanzm/now-in-android-app