Skip to content

Instantly share code, notes, and snippets.

@Diolor
Last active May 1, 2020 15:04
Show Gist options
  • Save Diolor/0fcbbe624c4ec652122df958c4fe3bb9 to your computer and use it in GitHub Desktop.
Save Diolor/0fcbbe624c4ec652122df958c4fe3bb9 to your computer and use it in GitHub Desktop.
/**
* ListAdapter is a superclass of RecyclerView.Adapter.
* Check the d.android.com for more.
*/
class JobsAdapter : ListAdapter<JobListItem, JobViewHolder>() {
}
// items of 2 types
sealed class JobListItem {
object Header : JobListItem()
data class JobItem(val payload: Payload) : JobListItem()
}
// a ViewHolder per item
sealed class JobViewHolder(...) : RecyclerView.ViewHolder(...) {
class HeaderViewHolder(...) : JobViewHolder(..)
class JobViewHolder(...) : JobViewHolder(..)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment