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
ConcatAdapterを深掘る
Search
Takahiro Shimokawa
August 12, 2021
Programming
490
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
2.9k
Android Studio 4.1推しポイント!
androhi
0
1.5k
一人開発でつまづいたときの処方箋
androhi
0
410
Androidの物理ベースアニメーション
androhi
1
680
ConstraintLayout再入門
androhi
2
3.6k
Firebase Analytics 使用感
androhi
0
930
Support Library v23.2 overview
androhi
0
770
Support Library 総復習
androhi
2
2.6k
(続)エンジニアのためのSketch3入門
androhi
1
3k
Other Decks in Programming
See All in Programming
AIを活用したE2Eテスト実装効率化のあゆみ / ebisu-mobile-14-kotetu
kotetuco
0
170
【やさしく解説 設計編・中級 #1】一つの車に、運転手は一人 ~ある倉庫システムの事例から~
panda728
PRO
0
180
琵琶湖の水は止められてもNet--HTTPのリトライは止められない / You might be able to stop the water flow of Lake Biwa but you can't stop Net::HTTP retries
luccafort
PRO
0
390
AI がコードを書く時代における新卒エンジニアの仕事風景 (2026) / New Graduate Engineers in the Era of AI Coding (2026)
sushichan044
0
220
型も通る、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
350
SREは、MCPとSRE Agentをこう使え!
kazumax55
0
150
技術記事、 専門家としてのプログラマ、 言語化
mizchi
14
7.5k
コーディングルールの鮮度を保ちたい for SRE NEXT 2026 / keep-fresh-go-internal-conventions-sre-next-2026
handlename
0
140
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
1
190
Foundation Models frameworkで画像分析
ryodeveloper
1
120
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
270
The Bowling Game- From Imperative to Functional Programming - Part 1
philipschwarz
PRO
0
330
Featured
See All Featured
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
72
40k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4.1k
Unsuck your backbone
ammeep
672
58k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
390
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
770
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
120k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.2k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
170
Six Lessons from altMBA
skipperchong
29
4.3k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.6k
Done Done
chrislema
186
16k
The Cult of Friendly URLs
andyhume
79
6.9k
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
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠