Skip to content

Instantly share code, notes, and snippets.

@AlexPrestonSB
Created November 5, 2019 23:04
Show Gist options
  • Save AlexPrestonSB/02cbc77173ec335d0ad7559e19b98954 to your computer and use it in GitHub Desktop.
Save AlexPrestonSB/02cbc77173ec335d0ad7559e19b98954 to your computer and use it in GitHub Desktop.
Shows how to create a View Holder for handling Location Messages
override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int
): RecyclerView.ViewHolder {
val layoutInflater = LayoutInflater.from(parent.context)
when (viewType) {
AppConstants.VIEW_TYPE_LOCATION_ME -> {
return MyLocationHolder(layoutInflater.inflate(R.layout.item_gchat_map_me, parent, false))
}
AppConstants.VIEW_TYPE_LOCATION_OTHER -> {
return OtherLocationHolder(layoutInflater.inflate(R.layout.item_gchat_map_other, parent, false))
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment