Skip to content

Instantly share code, notes, and snippets.

@Draketheb4dass
Created July 28, 2021 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Draketheb4dass/4c10ff1c50972a9a8bcb9260c0eec41e to your computer and use it in GitHub Desktop.
Save Draketheb4dass/4c10ff1c50972a9a8bcb9260c0eec41e to your computer and use it in GitHub Desktop.
package com.jephtecolin.kwii.ui.consumable_detail
import androidx.databinding.Bindable
import androidx.databinding.Observable
import androidx.databinding.ObservableDouble
import androidx.databinding.PropertyChangeRegistry
import androidx.lifecycle.LiveData
import androidx.lifecycle.MediatorLiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.jephtecolin.kwii.util.ObservableViewModel
import com.jephtecolin.model.Consumable
import com.jephtecolin.model.Topping
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
@HiltViewModel
class ConsumableDetailViewModel @Inject constructor() : ObservableViewModel() {
val topping = Topping("1", "Hot Cheese", 30.00)
val consumable = Consumable(
"1",
"Griot de boeuf",
"Food",
250.00,
"https://www.innovatorsmag.com/wp-content/uploads/2017/03/IF-Burger-1024x772.jpg",
"Griot de boeuf en sauce, servis avec des bananes pese, des frites et du salade",
"Boeuf, Banane, Choux, Radis",
)
var totalCost: ObservableDouble = ObservableDouble(0.0)
@Bindable get() {
return field
}
set(value) {
totalCost.set(value.get())
field = value
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment