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
ConcatAdapterを深掘る
Search
Takahiro Shimokawa
August 12, 2021
Programming
500
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ConcatAdapterを深掘る
Takahiro Shimokawa
August 12, 2021
More Decks by Takahiro Shimokawa
See All by Takahiro Shimokawa
PlayStoreでの新しいユーザー訴求 -LiveOpsの活用とその成果-
androhi
0
3k
Android Studio 4.1推しポイント!
androhi
0
1.5k
一人開発でつまづいたときの処方箋
androhi
0
430
Androidの物理ベースアニメーション
androhi
1
700
ConstraintLayout再入門
androhi
2
3.6k
Firebase Analytics 使用感
androhi
0
940
Support Library v23.2 overview
androhi
0
790
Support Library 総復習
androhi
2
2.6k
(続)エンジニアのためのSketch3入門
androhi
1
3k
Other Decks in Programming
See All in Programming
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
510
GitHubハンズオン講座 — 実務レベルのチーム開発のフローを身につけよう
junhat6
0
120
Rでドレミ/Do-Re-Mi_with_R
florets1
0
130
Embedded Swiftで作る自作USBデバイス によるiOSデバイスの自動テスト / iOSDC Japan 2026 glassfiber
glassfiber
0
310
外から家のPCの電源入れたい!をPHPで解決する
kawashimo0
1
120
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
110
パーソナライズPodcastを作った話
repunit11
0
130
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
34
16k
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
360
個人開発者よ、Honoを使え(おじさんver)
tanahiro2010
2
140
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
190
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
150
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
KATA
mclloyd
PRO
35
16k
Building the Perfect Custom Keyboard
takai
2
900
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
3.3k
Optimising Largest Contentful Paint
csswizardry
37
4k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
700
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
350
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
740
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
The Cult of Friendly URLs
andyhume
79
7k
Transcript
Լܟ߂ !BOESPIJ $PODBU"EBQUFSΛਂ۷Δ QPUBUPUJQT
w Լܟ߂ w ᷂;0;0ςΫϊϩδʔζॴଐ w !BOESPIJ w ϙϦϓςϧεʢݹڕʣ ࣗݾհ
ΞδΣϯμ w $PODBU"EBQUFSͱʁ w $PODBU"EBQUFSͷϢʔεέʔε w $PODBU"EBQUFSͷׂ w 7JFX5ZQFͱ4UBCMF*%ʹ͍ͭͯ w
$PODBU"EBQUFS͕ߦ͍ͬͯΔ੍ޚ w ·ͱΊ
$PODBU"EBQUFSͱʁ l"O3FDZDMFS7JFX"EBQUFSJNQMFNFOUBUJPOUIBUQSFTFOUTUIFDPOUFOUTPGNVMUJQMFBEBQUFSTJOTFRVFODFz "OESPJE%FWFMPQFST3FGFSFODF ˞3FDZDMFS7JFXϥΠϒϥϦWFSҎ্͕ඞཁͰ͢ val headerAdapter = HeaderAdapter() val itemAdapter
= ItemAdapter() val concatAdapter = ConcatAdapter(headerAdapter, itemAdapter) binding.recyclerView.adapter = concatAdapter
$PODBU"EBQUFSͱʁ RecyclerView ConcatAdapter HeaderAdapter ItemAdapter γʔέϯγϟϧ
$PODBU"EBQUFSͱʁ RecyclerView ConcatAdapter HeaderAdapter ItemAdapter γʔέϯγϟϧ
$PODBU"EBQUFSͷϢʔεέʔε )FBEFS *UFN" *UFN# 'PPUFS *UFN# *UFN" *UFN" *UFN" *UFN#
୯Ұͷ"EBQUFS w ͍Ζ͍Ζͳ7JFX5ZQFΛఆٛ w ͍Ζ͍Ζͳ7JFX)PMEFSͷੜͱEBUBͷCJOEJOH w ෳࡶͳϦετΞΠςϜͷΧϯτ $PODBU"EBQUFS w ࢠ"EBQUFSͷ࣮࣍ୈͰ7JFX5ZQFͷఆٛෆཁ w ґଘ͢Δ7JFX)PMEFSछྨ w γϯϓϧͳϦετΞΠςϜͷΧϯτ
$PODBU"EBQUFSͷׂ w Ճ͞Εͨ"EBQUFSͰOPUJGZϝιου͕ݺΕͨΒɺ3FDZDMFS7JFXʹ͑Δ લʹP⒎TFUΛܭࢉͯ͠OPUJGZ*UFN3BOHF$IBOHFE ΛݺͿ w $PODBU"EBQUFS$POpHΫϥεΛ༻͍ͯɺ7JFX5ZQFͱ4UBCMF*%ʹؔ͢Δ "EBQUFSؒͷ੍ޚΛߦ͏
3FDZDMFS7JF͆ʹ͑ΔલʹPGGTFUΛܭࢉ͢Δ @Override public void onItemRangeChanged(@NonNull NestedAdapterWrapper nestedAdapterWrapper, int positionStart, int
itemCount) { final int offset = countItemsBefore(nestedAdapterWrapper); mConcatAdapter.notifyItemRangeChanged( positionStart + offset, itemCount ); }
7JFX5ZQFͷ੍ޚʹ͍ͭͯ w 5SVF$PODBU"EBQUFSͷ"EBQUFSؒͰ7JFX5ZQFΛڞ༗͠ͳ͍ w 'BMTFશͯͷ"EBQUFS͕ಉ͡7JFX5ZQFͳΒಉ͡7JFX)PMEFSΛࢀর͢Δ ʢ(MPCBM7JFX5ZQF1PPMΛڞ༗͢Δʣ public final boolean isolateViewTypes
4UBCMF*%ͷ੍ޚʹ͍ͭͯ w *40-"5&%@45"#-&@*%4 w શͯͷ"EBQUFS͕4UBCMF*%Λ࣋ͭ͜ͱΛڧ੍͠ɺ"EBQUFSؒͰ*%ϓʔϧΛ͢Δ w /0@45"#-&@*%4 w "EBQUFS͕4UBCMF*%ΛΒͤΔ͜ͱΛཁٻ͠ͳ͍ʢσϑΥϧτʣ w
4)"3&%@45"#-&@*%4 w શͯͷ"EBQUFS͕4UBCMF*%Λ࣋ͭ͜ͱΛڧ੍͠ɺ"EBQUFSؒͰ*%ϓʔϧΛڞ༗͢Δ public final ConcatAdapter.Config.StableIdMode stableIdMode
$PODBU"EBQUFS͕ߦ͍ͬͯΔ੍ޚ public ConcatAdapter( @NonNull Config config, @NonNull List<? extends Adapter<?
extends ViewHolder>> adapters) { mController = new ConcatAdapterController(this, config); for (Adapter<? extends ViewHolder> adapter : adapters) { addAdapter(adapter); } super.setHasStableIds(mController.hasStableIds()); } public boolean hasStableIds() { return mStableIdMode != NO_STABLE_IDS; }
$PODBU"EBQUFS͕ߦ͍ͬͯΔ੍ޚ ConcatAdapterController(ConcatAdapter concatAdapter, ConcatAdapter.Config config) { mConcatAdapter = concatAdapter; //
setup view type handling if (config.isolateViewTypes) { mViewTypeStorage = new ViewTypeStorage.IsolatedViewTypeStorage(); } else { mViewTypeStorage = new ViewTypeStorage.SharedIdRangeViewTypeStorage(); } // setup stable id handling mStableIdMode = config.stableIdMode; if (config.stableIdMode == NO_STABLE_IDS) { mStableIdStorage = new StableIdStorage.NoStableIdStorage(); } else if (config.stableIdMode == ISOLATED_STABLE_IDS) { mStableIdStorage = new StableIdStorage.IsolatedStableIdStorage(); } else if (config.stableIdMode == SHARED_STABLE_IDS) { mStableIdStorage = new StableIdStorage.SharedPoolStableIdStorage(); } else { throw new IllegalArgumentException("unknown stable id mode"); } }
͞Βʹਂງͬͨ༰ %SPJE,BJHJʹͯʁ
·ͱΊ w $PODBU"EBQUFSΛ͏͜ͱͰɺෳͷ"EBQUFSΛ3FDZDMFS7JFXʹηοτͰ ͖Δ w "EBQUFSؒͷ7JFX5ZQF4UBCMF*%ͷ੍ޚΛɺ$PODBU"EBQUFSͷ෦Ͱ͍͍ ײ͡ʹͬͯ͘ΕΔ w Ͳ͏͍͍ͬͯײ͡ʹͯ͠Δͷ͔ΛௐͯΈΔͱ໘നͦ͏
ࢀߟυΩϡϝϯτ w IUUQTNFEJVNDPNBOESPJEEFWFMPQFSTNFSHFBEBQUFSTTFRVFOUJBMMZ XJUINFSHFBEBQUFSEB w IUUQTEFWFMPQFSBOESPJEDPNSFGFSFODFBOESPJEYSFDZDMFSWJFX XJEHFU$PODBU"EBQUFS w IUUQTEFWFMPQFSBOESPJEDPNSFGFSFODFBOESPJEYSFDZDMFSWJFX XJEHFU$PODBU"EBQUFS$POpH
w IUUQTEFWFMPQFSBOESPJEDPNSFGFSFODFBOESPJEYSFDZDMFSWJFX XJEHFU$PODBU"EBQUFS$POpH4UBCMF*E.PEF
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠