Created
October 15, 2020 08:47
-
-
Save STAR-ZERO/a0779b8863334d9ca9c59a5d0391aaf3 to your computer and use it in GitHub Desktop.
Find an adapter from ConcatAdapter global position.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun ConcatAdapter.findAdapter(position: Int): RecyclerView.Adapter<*>? { | |
var totalCount = 0 | |
adapters.forEach { adapter -> | |
totalCount += adapter.itemCount | |
if (position < totalCount) { | |
return adapter | |
} | |
} | |
return null | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment