ViewModel

class ViewModel(context: Context, project: Project, val product: Product, scannedCode: ScannedCode)

The view model of the product confirmation dialog, should be helpful if you want to customize that dialog.

Constructors

Link copied to clipboard
constructor(context: Context, savedInstanceState: Bundle)

Restore the ViewModel from a context and the savedInstanceState. Can throw IllegalArgumentException when the project cannot be found or onSaveInstanceState was not called.

constructor(context: Context, project: Project, product: Product, scannedCode: ScannedCode)

Properties

Link copied to clipboard

The add to cart button text (varies if the user updates the quantity)

Link copied to clipboard

A applied coupon like a manual discount, can be null

Link copied to clipboard

The raw cart item

Link copied to clipboard

The deposit price of the product, can be null

Link copied to clipboard

The button text do enter manual discounts, can be null when no coupons are available

Link copied to clipboard

The original price of the product, can be null

Link copied to clipboard

The price to display

Link copied to clipboard

The content description of the price

Link copied to clipboard

The product raw data

Link copied to clipboard

The quantity of the product, can be null e.g. in case of user weighted products

Link copied to clipboard

True when the plus and minus buttons should be shown

Link copied to clipboard

True when the quantity can be changed

Link copied to clipboard

True when the quantity can be decreased. Can be false when there is no quantity or the quantity is 1

Link copied to clipboard

True when the quantity can be increased. Can be false when there is no quantity or the limit is reached

Link copied to clipboard

The content description of the quantity, can be null

Link copied to clipboard

True when the quantity can be changed

Link copied to clipboard

The related shopping cart

Link copied to clipboard

True when the item was added to the cart

Functions

Link copied to clipboard
fun addToCart()
Link copied to clipboard
fun dismiss()

Call this when the dialog is dismissed to cleanup internal resources

Link copied to clipboard

Called to ask the view model to save its current dynamic state, so it can later be reconstructed in a new instance if its process is restarted.