Last active
January 6, 2026 13:19
-
-
Save linreal/16b9772ad8c42d1c893f92f096803688 to your computer and use it in GitHub Desktop.
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
| // RecyclerView | |
| override fun getItemViewType(position: Int): Int { | |
| return when (items[position]) { | |
| is TextMessage -> VIEW_TYPE_TEXT | |
| is ImageMessage -> VIEW_TYPE_IMAGE | |
| is VideoMessage -> VIEW_TYPE_VIDEO | |
| else -> VIEW_TYPE_UNKNOWN | |
| } | |
| } | |
| // LazyColumn | |
| LazyColumn { | |
| items( | |
| items = messages, | |
| key = { message -> message.id }, | |
| contentType = { message -> | |
| when (message) { | |
| is Message.TextMessage -> "text" | |
| is Message.ImageMessage -> "image" | |
| is Message.VideoMessage -> "video" | |
| } | |
| } | |
| ) { message -> | |
| MessageItem(message) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment