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
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
930
自作アプリのアイコンを作った話
aosa4054
0
260
Other Decks in Programming
See All in Programming
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
210
TechTown - Creating Composable Callables in Contemporary C++
rollbear
0
110
技術的負債の返済は、AI時代の複利で効く投資 — 経営としての意思決定とその遂行
curekoshimizu
1
2.3k
JRuby: Past, Present, and Future
headius
0
230
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
210
CodeRabbitの効果検証と過ごしてみた3ヶ月
armondando
0
230
ActionController meets Protocol Buffers
sorah
0
220
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
22
22k
R8 の設定見直しでアプリサイズ削減
andpad
0
210
なぜCTOを降りてFDEを選んだのか?〜なぜプロダクト企業がFDEで顧客の現場に踏み込むのか〜
gonta
1
200
Event is what happens
moro
1
310
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.6k
Featured
See All Featured
The Mindset for Success: Future Career Progression
greggifford
PRO
0
530
エンジニアに許された特別な時間の終わり
watany
109
250k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
700
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
Done Done
chrislema
187
17k
Deep Space Network (abreviated)
tonyrice
0
370
RailsConf 2023
tenderlove
30
1.6k
[RailsConf 2023] Rails as a piece of cake
palkan
59
7.1k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
203
77k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
300
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