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
790
実用 Picture in Picture
aosa4054
2
920
自作アプリのアイコンを作った話
aosa4054
0
250
Other Decks in Programming
See All in Programming
ルールを書いて終わらせないハーネスエンジニアリング
yug1224
5
1.9k
yield再入門 #phpcon
o0h
PRO
0
1.1k
変わらないものが、変わるものを決める — 意図駆動開発 × イベントソーシング × イミュータブル | What Doesn't Change Decides What Can — IDD × Event Sourcing × Immutability
tomohisa
0
1.8k
Go言語とトイモデルで学ぶTransformerの気持ち / fukuokago23-transformer
monochromegane
0
180
仕様駆動開発へのトライを機に チームに適合する手法を模索し続けている話
freee
PRO
0
560
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
500
リアルな遅延を測る仕様
kota_yata
1
120
型も通る、synthも通る、それでも危ない 〜AIのCDKの権限とコストを機械で検証する〜 / It Passes Type Checks, It Passes Synth Checks, but It’s Still Risky — Automatically Verifying Permissions and Costs in AI’s CDK —
seike460
PRO
1
570
React本体のコードリーディング
high_g_engineer
1
150
AIが無かった頃の素敵な出会いの話
codmoninc
1
460
Detecting Compromised CI with eBPF and Cilium Tetragon
lizrice
0
210
AIを紡ぐPMのお話
swdtkuy
0
110
Featured
See All Featured
ラッコキーワード サービス紹介資料
rakko
1
4.4M
Abbi's Birthday
coloredviolet
3
9.4k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
490
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Testing 201, or: Great Expectations
jmmastey
46
8.2k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
770
Designing Experiences People Love
moore
143
24k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
390
Skip the Path - Find Your Career Trail
mkilby
1
190
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.3k
Claude Code のすすめ
schroneko
67
230k
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