-
-
Save kozmi55/aced21ed387571b16b4b225c6184fa98 to your computer and use it in GitHub Desktop.
ItemViewModels
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
interface ItemViewModel { | |
@get:LayoutRes | |
val layoutId: Int | |
val viewType: Int | |
get() = 0 | |
} | |
class HeaderViewModel(val title: String) : ItemViewModel { | |
override val layoutId: Int = R.layout.item_header | |
override val viewType: Int = CarListViewModel.HEADER_ITEM | |
} | |
class CarAdViewModel(val make: String, val model: String, val price: String) : ItemViewModel { | |
override val layoutId: Int = R.layout.item_car_listing_ad | |
override val viewType: Int = CarListViewModel.AD_ITEM | |
} | |
class CarListingViewModel(val make: String, val model: String, val price: String) : ItemViewModel { | |
override val layoutId: Int = R.layout.item_car_listing | |
override val viewType: Int = CarListViewModel.LISTING_ITEM | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment