I have a few different model data classes that I need to display in a recycler view. All of these item views will look the same, the only difference is that when they are pressed, they need to send over the specific model class to view its detail.
I was thinking of using some interface or parent class, but I'm not sure if they work well with data classes in Kotlin.
I need the supertype to be something like a data class, so in my DiffCallback I can call oldItem == newItem
for areContentsTheSame
.
How would you go about trying to extract the common properties each model data class has, using that supertype in the adapter, and then dealing with areContentsTheSame
for the DiffCallback?