Skip to content

Instantly share code, notes, and snippets.

@AlexPrestonSB
Created November 5, 2019 23:04
Show Gist options
  • Save AlexPrestonSB/60f0d906a2783794ab2dabb1a7f9f6a6 to your computer and use it in GitHub Desktop.
Save AlexPrestonSB/60f0d906a2783794ab2dabb1a7f9f6a6 to your computer and use it in GitHub Desktop.
Shows how to specify a Custom ViewType for the Location Message
override fun getItemViewType(position: Int): Int {
val message = messages.get(position)
when (message) {
is UserMessage -> {
return if (message.sender.userId == SendBird.getCurrentUser().userId) {
if (message.customType == "location") {
AppConstants.VIEW_TYPE_LOCATION_ME
}
} else {
if (message.customType == "location") {
AppConstants.VIEW_TYPE_LOCATION_OTHER
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment