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
Paging Library は便利だぞ!
Search
Hunachi
June 08, 2018
Programming
1
460
Paging Library は便利だぞ!
#hakata_apk で発表した際のスライドです.
# Android
Hunachi
June 08, 2018
Tweet
Share
More Decks by Hunachi
See All by Hunachi
PDF Viewer作成の今までとこれから
hunachi
0
2.5k
Google Play ポリシー対応周りの整理/改善をしてみた
hunachi
0
380
レビューダイアログ機能の取り組みAndroid編 / Review Dialog for Android
hunachi
0
1.4k
Git Hands On for my lab.
hunachi
0
100
Google I/O 2018’s Extensions🦔
hunachi
1
2.5k
ML Kitはいいぞ!
hunachi
0
860
Androidについて.
hunachi
0
120
Other Decks in Programming
See All in Programming
“あなた” の開発を支援する AI エージェント Bedrock Engineer / introducing-bedrock-engineer
gawa
4
320
非ブラウザランタイムとWeb標準 / Non-Browser Runtimes and Web Standards
petamoriken
0
430
watsonx.ai Dojo #6 継続的なAIアプリ開発と展開
oniak3ibm
PRO
0
170
令和7年版 あなたが使ってよいフロントエンド機能とは
mugi_uno
10
5.2k
Package Traits
ikesyo
1
210
return文におけるstd::moveについて
onihusube
1
1.4k
カンファレンス動画鑑賞会のススメ / Osaka.swift #1
hironytic
0
170
各クラウドサービスにおける.NETの対応と見解
ymd65536
0
250
php-conference-japan-2024
tasuku43
0
430
Оптимизируем производительность блока Казначейство
lamodatech
0
960
ChatGPT とつくる PHP で OS 実装
memory1994
PRO
3
190
技術的負債と向き合うカイゼン活動を1年続けて分かった "持続可能" なプロダクト開発
yuichiro_serita
0
300
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
222
9k
Bash Introduction
62gerente
610
210k
VelocityConf: Rendering Performance Case Studies
addyosmani
327
24k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2k
Automating Front-end Workflow
addyosmani
1366
200k
The Cost Of JavaScript in 2023
addyosmani
46
7.2k
KATA
mclloyd
29
14k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
19
2.3k
How to Ace a Technical Interview
jacobian
276
23k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
The Pragmatic Product Professional
lauravandoore
32
6.4k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Transcript
Paging Libraryศརͩͧʂ # # #
ࣗݾհ ▪ ;ͳͪʢHana Kondoʣ ▪ ٱཹถߴઐ ੍ޚใֶՊ 4ʢΪϦΪϦ18ࡀʣ ▪ AndroidΛ৮ΓॳΊͯ1.5͘Β͍ʁͷ·ͩ·ͩະख़ऀɽ
▪ Kotlin͕͖ɽ ▪ ॳΊͯͷ෦֎LTͰ͢ɽ ▪ ·͔͞Γͬͯ·͢ʂ @Hunachi @_hunachi
Paging Library ͱ? ▪ RecyclerViewඞཁͳ͚ͩঃʑʹऔಘͯ͘͠ΕΔɽ Ø εΫϩʔϧ͍ͯͬͯ͠ऴʹۙͣ͘ͱଓ͖ͷItemΛऔಘͯ͘͠ΕΔɽ ▪ ॳΊͯදʹݱΕͨͷڈͷ9݄ɽ ▪
Android JetPackͷҰһʂ ▪ ࠓͷ Google I/O Ͱ҆ఆ൛͕ϦϦʔε͞Εͨʂʢ͔ͩΒnew!ʣ
None
▪ ແݶʹ͍ListΛऔಘ͍ͨ࣌͠ɼද͍͚ࣔͤͨͩ͞ใΛऔಘɽ Ø ແବͳ௨৴ϝϞϦΛΘͳ͍ɽ Ø εϜʔζʹߋ৽͞ΕΔͷͰɼUX্͕ɽ ▪ PagingΛࣗͰ࣮͠ͳ͍͍͔ͯ͘Βָʂ ▪ Roomͱͷ૬ੑൈ܈ʂҰॹʹ͏ͱΊͬͪΌָͰ͖Δʂ
▪ Data OK Ø NetɼDataBaseɼFileɽɽɽ ͏ར
͍ํ ᶃ ListAdapter Λͬͨ RecyclerView Λ࡞Δɽ ᶄ ListAdapter -> PagedListAdapterʹ͢Δɽ
ᶅ DataSource ͱ DataSource.Factory Λ࡞Δɽ ᶆ BuilderΛ࡞Δɽ ᶇ ViewModelʹLiveData<PagedList>Λ࡞Δɽ ᶈ submitListΛͯ͠ʂ Ͳ͏͍͏αΠΫϧͰಈ͔͘ɼCodelabͷWrap upʹॻ͍ͯ͋Δ ͷͰࠓճ࣮ํ๏ͷΈհ͠·͢ɽ
https://www.youtube.com/watch?v=QVMqCRs0BNA
ListAdapter -> PagedListAdapterʹ͢Δɽ
DataSourceͱDataSource.FactoryΛ࡞Δɽ σʔλݩ͕େ͖͚͘Δͱɼ3έʔε͋Δɽ 1. DataBaseʢRoomͱซ༻ʣ 2. DataBase + OtherSourceʢ ྫ: NetWork
ʣ 3. OtherSourceʢྫ: NetWork ʣ
DataBaseRoom ▪ List<Memo> -> DataSource.Factory<Int, Memo> ʹ͢Δ͚ͩɽ
DataBase + OtherSourceʢྫ: NetWork ʣ ▪ DB͔ΒσʔλΛऔಘ͠ɼσʔλ͕Γͳ͘ͳͬͨΒBoundaryCallbackʹ௨ɽ ▪ σʔλΛAPI͔Βऔ͖ͬͯͯɼDBΛߋ৽͢Δɽ ▪
PagingͷCodeLab͕͜ͷܗɽ https://codelabs.developers.google.com/codelabs/android-paging/.
ଓ͖ ▪ BoundaryCallback͜Μͳײ͡ɽ
OtherSourceʢྫ: NetWork ʣ ▪ DataSourceΛ͜Μͳײ͡Ͱ࡞Δɽʢσʔλݩ͕ϖʔδϯάʹରԠ͍ͯ͠Δʣ
ଓ͖ ▪ DataͷऴΘΓnullͰڭ͑ͯ͋͛Δɽ ▪ ΤϥʔϋϯυϦϯάɼϦτϥΠॲཧɼ Executorͱ͔LiveDataΛͬͯؤு ΔʂʢެࣜͷαϯϓϧΛΈΔͱ͍͍ͱࢥ͍·͢ʂʣ ▪ σʔλݩ͕ϖʔδϯάʹରԠ͍ͯ͠Δ߹ Ø
PageKeyedDataSource Λ͏ɽ Ø callbackͷҾ͕ ListͱݱࡏͷPageɽ ▪ σʔλݩ͕ϖʔδϯάʹରԠ͍ͯ͠ͳ͍߹ Ø ItemKeyedDataSource Λ͏ɽ Ø callbackͷҾ͕ Item ͷΈɽ
BuilderΛ࡞Δɽ
࠷ޙʹsubmitList͢Δɽ
▪ )* Demo,/0 ▪ 5 1 #&-4
6 ! ▪ "$ ▪ https://github.com/Hunachi/wantedly-coding-challenge-publicNetWork ▪ https://github.com/Hunachi/HunaSchedule2 DataBase!%'(+2 3-.
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ɽ