Last active
November 13, 2021 10:41
-
-
Save seoft/40df9d620427a8975e71c20db258b35b to your computer and use it in GitHub Desktop.
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
sealed class AntonioUiModel( | |
val type: Type, | |
open val id: Long, | |
open val price: Int | |
) : AntonioBindingModel { | |
enum class Type { MONITOR, MOUSE, PHONE } | |
override fun bindingVariableId(): Int = BR.item | |
data class Monitor(override val id: Long, override val price: Int, val inch: Float) : | |
AntonioUiModel(Type.MONITOR, id, price) { | |
override fun layoutId(): Int = R.layout.item_antonio_monitor | |
} | |
data class Mouse(override val id: Long, override val price: Int, val buttonCount: Int) : | |
AntonioUiModel(Type.MOUSE, id, price) { | |
override fun layoutId(): Int = R.layout.item_antonio_mouse | |
} | |
data class Phone(override val id: Long, override val price: Int, val os: String) : | |
AntonioUiModel(Type.PHONE, id, price) { | |
override fun layoutId(): Int = R.layout.item_antonio_phone | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment