-
-
Save AlexPrestonSB/60f0d906a2783794ab2dabb1a7f9f6a6 to your computer and use it in GitHub Desktop.
Shows how to specify a Custom ViewType for the Location Message
This file contains 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
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