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
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
4
3.4k
現場と育てるRailsモデリング 〜Spreadsheetから始めたモデル設計〜
siroemk
2
1.1k
プロジェクトコードをキレイキレイしよう!暗黙的な参照を読み解く静的解析
ostk0069
0
180
Apple Intelligenceとオンデバイス時代の到来
yahir0
0
170
コーディング自動化の次へ。人の介入をゼロにするファクトリーとサポートAIによる実践
timakin
5
4.8k
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
140
Seven New Principles of Software Engineering
yegor256
0
370
エージェントを使い続けるためのメタワーク / Meta-work for keeping using the agent
rkaga
6
2k
TS 7.0 で baseUrl が使えなくなった今、パスエイリアスをどうするか
bicstone
1
210
自作Discord音声botをLambda MicroVMsに移行した話 / Migrating My Discord Voice Bot to Lambda MicroVMs
akihisaikeda
0
190
PyConTW 2026 - AI Coding 不只是工具升級, 區域醫院醫療資訊系統協作開發與資訊團隊轉型實踐
cclai999
0
210
No More NoSuchMethodError
exoego
1
120
Featured
See All Featured
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.5k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
1
290
For a Future-Friendly Web
brad_frost
184
11k
Building AI with AI
inesmontani
PRO
1
1.3k
Balancing Empowerment & Direction
lara
6
1.3k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.8k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
570
Agile that works and the tools we love
rasmusluckow
331
22k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
It's Worth the Effort
3n
188
29k
Exploring anti-patterns in Rails
aemeredith
4
550
Rails Girls Zürich Keynote
gr2m
96
14k
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
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠