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
470
Paging Library は便利だぞ!
#hakata_apk で発表した際のスライドです.
# Android
Hunachi
June 08, 2018
Tweet
Share
More Decks by Hunachi
See All by Hunachi
TopAppBar Composableをカスタムする
hunachi
0
140
PDF Viewer作成の今までとこれから
hunachi
0
2.9k
Google Play ポリシー対応周りの整理/改善をしてみた
hunachi
0
390
レビューダイアログ機能の取り組みAndroid編 / Review Dialog for Android
hunachi
0
1.5k
Git Hands On for my lab.
hunachi
0
110
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
Develop Faster With FrankenPHP
dunglas
2
2.7k
MCP世界への招待: AIエンジニアが創る次世代エージェント連携の世界
gunta
2
590
PHPer's Guide to Daemon Crafting Taming and Summoning
uzulla
2
1.1k
英語文法から学ぶ、クリーンな設計の秘訣
newnomad
1
270
複数ドメインに散らばってしまった画像…! 運用中のPHPアプリに後からCDNを導入する…!
suguruooki
0
440
Return of the Full-Stack Developer
simas
PRO
1
320
S3静的ホスティング+Next.js静的エクスポート で格安webアプリ構築
iharuoru
0
200
AHC 044 混合整数計画ソルバー解法
kiri8128
0
300
小さく段階的リリースすることで深夜メンテを回避する
mkmk884
2
130
snacks.nvim内のセットアップ不要なプラグインを紹介 / introduce_snacks_nvim
uhooi
0
350
ニックトレイン登壇資料
ryotakurokawa
0
140
フロントエンドテストの育て方
quramy
11
2.6k
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
328
38k
The Pragmatic Product Professional
lauravandoore
33
6.5k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
51
2.4k
Being A Developer After 40
akosma
90
590k
Thoughts on Productivity
jonyablonski
69
4.5k
Bash Introduction
62gerente
611
210k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
30
1.1k
How STYLIGHT went responsive
nonsquared
99
5.4k
Large-scale JavaScript Application Architecture
addyosmani
511
110k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
4
500
Build your cross-platform service in a week with App Engine
jlugia
229
18k
RailsConf 2023
tenderlove
29
1k
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-.
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ɽ