Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aasierra/8512768acc9550aae2e2d9b7c52020e6 to your computer and use it in GitHub Desktop.
Save aasierra/8512768acc9550aae2e2d9b7c52020e6 to your computer and use it in GitHub Desktop.
/**
* Business logic center.
*/
class ProductInfoBusinessLogicCenterViewModel: ViewModel() {
/**
* Observable object for the view to watch.
*/
val productInfo = MutableLiveData<ProductInfoDisplay>()
init {
val fakeServerResponseObject = ServerObject(ServerProductInformation("Product Name", "$1,000,000", true))
/**
* Grabbing only what the view needs to know about from the response.
*/
productInfo.value = ProductInfoDisplay(fakeServerResponseObject.product.productName, fakeServerResponseObject.product.price)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment