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
matching_dev1
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Ryo.Nitami
November 14, 2018
Technology
280
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
matching_dev1
https://matching-dev-group.connpass.com/event/104675/
Ryo.Nitami
November 14, 2018
More Decks by Ryo.Nitami
See All by Ryo.Nitami
20220927_mot_kauche_tummy
bird_tummy
0
140
Chucker で GraphQL の通信ログを見やすくした / Made GraphQL log easier to read on Chucker
bird_tummy
1
1.1k
dxel1
bird_tummy
0
4.1k
GraphQL in production
bird_tummy
3
3.6k
livedata-plus-viewmodel
bird_tummy
0
3.7k
何も準備せずにノリで上海に行ったら大変だった話 / shanghai-is-wonderful
bird_tummy
0
440
AutoLayout と友達になる方法 / How to be friends with AutoLayout
bird_tummy
1
3.2k
初めて転職して思ったこと / ngineerxiv11
bird_tummy
0
410
"DO NOT translate when you talk or listen" を実現するためにやっていること / clem6
bird_tummy
2
210
Other Decks in Technology
See All in Technology
AIは実装を速くする。では、私たちは何を今作るべきか?-立場を越えてリリースに向き合ったチーム開発の実践 / 20260801 Hiromi Nakaya and Naoki Takahashi
shift_evolve
PRO
3
450
モバイルアプリ開発概論2026
recruitengineers
PRO
4
510
強化学習「理論」入門
enakai00
3
3.6k
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
4
24k
生成 AI の基礎 〜 サンプル実装で学ぶ基本原理
enakai00
7
4.4k
ホームラボ紹介
y_sera15
0
130
20260804_Q4AzureUpdateBite_FabricDataAgentの精度を高める設計.pdf
matayuuu
1
120
修正PRを食べてレビュースキルが賢くなる:Claude Codeによる自己改善サイクル
yuyaumetsu
6
1.4k
ラジオの科学
frievea
0
280
【CEDEC2026】グラフィックスエンジニアのためのニューラルシェーディング入門
cygames
PRO
0
130
トヨタ⽣産⽅式(TPS)⼊⾨
recruitengineers
PRO
3
650
JavaScript 研修 (2026)
recruitengineers
PRO
2
460
Featured
See All Featured
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
360
Building Applications with DynamoDB
mza
96
7.2k
Music & Morning Musume
bryan
47
7.3k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Darren the Foodie - Storyboard
khoart
PRO
3
3.6k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
210
Building AI with AI
inesmontani
PRO
1
1.1k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
410
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
250
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
250
Claude Code のすすめ
schroneko
67
230k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
850
Transcript
Paging Library ʹ͓͚ΔΞΫγϣϯΛ ϑοΫʹͨ͠Ϧετߋ৽ 2018/11/14 Matching Dev Meetup: iOS /
Android Paging Library ʹ͓͚ΔΞΫγϣϯΛϑοΫʹͨ͠Ϧετߋ৽ 1
Who? — Ryo Nitami — Android Application Engineer @ playmotion,
Inc. — Twitter: bird_tummy — GitHub: rnitame Paging Library ʹ͓͚ΔΞΫγϣϯΛϑοΫʹͨ͠Ϧετߋ৽ 2
Ϋϩεϛʔ — "͢Εҧ͍Λ࿀ͷ͖͔͚ͬʹ" — ҐஔใΛͬͨϚονϯάαʔϏε — 10/30 ʹ Android ΞϓϦΛϑϧϦχϡʔΞϧ͠·ͨ͠ʂ
— Architecture Components ΓΓ + Kotlin 100% — ͜Ε͔ΒΞοϓσʔτ͕ΜΓ·͢ Paging Library ʹ͓͚ΔΞΫγϣϯΛϑοΫʹͨ͠Ϧετߋ৽ 3
Paging Library — 2017 ͷ I/O Ͱൃද͞ΕͨɺϖʔδϯάʹಛԽͨ͠ϥΠϒ ϥϦ — "The
Paging Library makes it easier for you to load data gradually and gracefully within your app's RecyclerView." — 2018/11/14 ݱࡏɺ2.1.0-beta01 Paging Library ʹ͓͚ΔΞΫγϣϯΛϑοΫʹͨ͠Ϧετߋ৽ 4
Paging Library ʹ͓͚ΔΞΫγϣϯΛϑοΫʹͨ͠Ϧετߋ৽ 5
ΫϩεϛʔͰͷར༻ྫ — Ϧετʹͳ͍ͬͯΔͱ͜Ζ͢ ͯ Paging Library Paging Library ʹ͓͚ΔΞΫγϣϯΛϑοΫʹͨ͠Ϧετߋ৽ 6
ΞΫγϣϯΛϑοΫʹͨ͠Ϧετߋ ৽ — ඇදࣔϢʔβʔϦετͳͲ — ʮϘλϯΛԡ͢ → API Λୟ͘ →
View Λߋ৽͢Δʯͱ͍͏ྲྀΕ͕ ༷ʑͳ໘Ͱൃੜ Paging Library ʹ͓͚ΔΞΫγϣϯΛϑοΫʹͨ͠Ϧετߋ৽ 7
·ͬͨͱ͜Ζ — PagedList ཁૉͷՃߋ৽ɺআ͕Ͱ͖ͳ͍ Paging Library ʹ͓͚ΔΞΫγϣϯΛϑοΫʹͨ͠Ϧετߋ৽ 8
PagedList ཁૉͷՃߋ৽ɺআ͕Ͱ͖ͳ͍ — issue tracker Ͱʮόά͡Όͳͯ͘ػೳ͕Γ͍ͯͳ͍ͩ ͚ͩʂʯͱ͍͏͕ٞ1 1 https://issuetracker.google.com/issues/74916992 Paging
Library ʹ͓͚ΔΞΫγϣϯΛϑοΫʹͨ͠Ϧετߋ৽ 9
PagedList MutableList Ͱͳ͍ʂ — googlesamples ͷ issue Ͱ Room
͓ͬͯίϝϯτ͕ ͋Δ2 — ΫϩεϛʔͰ͜ͷํ๏ͰରԠ 2 https://github.com/googlesamples/android-architecture-components/issues/281 Paging Library ʹ͓͚ΔΞΫγϣϯΛϑοΫʹͨ͠Ϧετߋ৽ 10
Room ܦ༝ͰϦετදࣔ Paging Library ʹ͓͚ΔΞΫγϣϯΛϑοΫʹͨ͠Ϧετߋ৽ 11
class UserBoundaryCallback( private val helper: UserPagingRequestHelper ) : PagedList.BoundaryCallback<User>() {
@MainThread override fun onZeroItemsLoaded() { } @MainThread override fun onItemAtFrontLoaded(itemAtFront: User) { } @MainThread override fun onItemAtEndLoaded(itemAtEnd: User) { super.onItemAtEndLoaded(itemAtEnd) // API Λୟ͍ͯ get data helper.loadAfterIfNotRunning(before = itemAtEnd.time) } } Paging Library ʹ͓͚ΔΞΫγϣϯΛϑοΫʹͨ͠Ϧετߋ৽ 12
@Dao interface UserDao { @Query("SELECT * FROM users") fun allUsers():
DataSource.Factory<Int, User> @Insert(onConflict = OnConflictStrategy.REPLACE) fun save(users: List<User>): List<Long> } Paging Library ʹ͓͚ΔΞΫγϣϯΛϑοΫʹͨ͠Ϧετߋ৽ 13
private val config = PagedList.Config.Builder() .setEnablePlaceholders(false) .setInitialLoadSizeHint(LOAD_COUNT) .setPageSize(LOAD_COUNT) .build() private
val helper = UserPagingRequestHelper().start() // ͜ͷ LiveData Λ Activity / Fragment Ͱ observe ͯ͠ submitList val users = LivePagedListBuilder(userDatabase.dao().allUsers(), config) .setBoundaryCallback(UserBoundaryCallback(helper)) .setFetchExecutor(executor) .build() fun updateUsers() { // DB ʹอଘ } fun deleteUser(userId: Long) { // DB ͷϢʔβʔΛߋ৽ͭͭ͠ɺ֘ API ୟ͘ } Paging Library ʹ͓͚ΔΞΫγϣϯΛϑοΫʹͨ͠Ϧετߋ৽ 14
·ͱΊ — Paging Library ͱ Room ΛͬͯɺΞΫγϣϯΛϑοΫʹ ͨ͠Ϧετߋ৽ͷ࣮Λͨ͠ — PagedList
Λ͍͡ΕΕ͍͍ͳͱࢥ͏͕ɺPaging Library ࣗମͷׂΛߟ͑Δͱ͜͏͢Δͷ͕ࣗવʁ — ࠓޙͷΞοϓσʔτʹظ Paging Library ʹ͓͚ΔΞΫγϣϯΛϑοΫʹͨ͠Ϧετߋ৽ 15
͋Γ͕ͱ͏͍͟͝·ͨ͠ Paging Library ʹ͓͚ΔΞΫγϣϯΛϑοΫʹͨ͠Ϧετߋ৽ 16