-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to define viewTypes with conditions #69
Comments
Hi @MahmoudMabrok, Thank you for your question. You specify this while you are defining your You need to define In the list, which you provide the adapter, you should do that mapping. val list = listOf("abc", "xyz", "qwe", ...)
...
// mapper
val dataSource = list.mapIndexed{index, item ->
if (index ÷ 2 == 0) Head(item) else Sub(item)
}
adapter.submitList(dataSource) In that way, you can test your mapper. I hope everything is clear now. Sincerely |
it will more better if it added with register function |
Do you mean putting type in the |
yes,or a way to determine type i think it need brain storm to get right design |
Actually type is coming by RecyclerViewHolder. As it is reified Kiel could understand which type it is. I appreciate your support. Any syntax alternatives are welcome. |
now we can
register viewTypes
but README has no way to determine which viewType is created at spefici position i.ehow to make views has two types
Head
,Sub
Head
with odd positionsSub
with even positionsThe text was updated successfully, but these errors were encountered: