I have the following ViewModel with a second constructor:
class MaleActivityViewModel() : ViewModel() {
val currency: String = Resources.getSystem().getString(R.string.currency)
private lateinit var serviceTextListMale: List<String>
private lateinit var serviceImageAdapter: CarouselPicker.CarouselViewAdapter
constructor(activity: Context) : this() {
//Text list of all the services
val haircut: String = Resources.getSystem().getString(R.string.service_haircut)
val massage: String = Resources.getSystem().getString(R.string.service_massage)
serviceTextListMale = listOf(haircut, massage)
//Carousel builder
val imageItems: MutableList<CarouselPicker.PickerItem> = ArrayList()
imageItems.add(CarouselPicker.DrawableItem(R.drawable.ic_mens_haircut))
imageItems.add(CarouselPicker.DrawableItem(R.drawable.ic_mens_massage))
serviceImageAdapter = CarouselPicker.CarouselViewAdapter(activity, imageItems, 0)
}
}
How do I call it in the activity class? Currently I have this, but would like to pass in the activity argument too:
viewModel = ViewModelProvider(this).get(MaleActivityViewModel::class.java)