Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Now in Android Overview
Search
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
780
実用 Picture in Picture
aosa4054
2
920
自作アプリのアイコンを作った話
aosa4054
0
250
Other Decks in Programming
See All in Programming
トークンをケチるな、設計しろ:GitHub Copilotを賢く使うコンテキスト戦略
ochtum
0
250
LaravelLive Japan の裏方のすべて — 第188回 PHP勉強会@東京 (2026-06-24)
suguruooki
2
130
symfony/aiとlaravel/boost
77web
0
100
Observability in Practice:Grafana 與 Edge Device SRE 的那些事
blueswen
0
180
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
200
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
310
Javaの型とAI時代に型が大事な理由 / java types and type in AI era
kishida
2
160
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
4.6k
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
200
はてなアカウント基盤 State of the Union
cockscomb
1
1.1k
フロントエンドとバックエンドで「1文字」を揃えよう
youkidearitai
PRO
0
770
Skillsは効率化、Agentsは"自分の拡張"——Builder時代のエージェント編成(CC Night 2026)
wemra
1
180
Featured
See All Featured
Designing for humans not robots
tammielis
254
26k
What does AI have to do with Human Rights?
axbom
PRO
1
2.2k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
72
40k
[SF Ruby Conf 2025] Rails X
palkan
2
1.1k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
630
Technical Leadership for Architectural Decision Making
baasie
3
430
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
150
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
180
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.5k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
290
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