Gitlab@Informatics
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Advance Navigation and ViewModel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
android
Advance Navigation and ViewModel
Commits
265f23b8
Commit
265f23b8
authored
2 years ago
by
62160052
Browse files
Options
Downloads
Patches
Plain Diff
Create OrderViewModel
parent
fe705971
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/src/main/java/com/example/cupcake/model/OrderViewModel.kt
+29
-0
29 additions, 0 deletions
...src/main/java/com/example/cupcake/model/OrderViewModel.kt
with
29 additions
and
0 deletions
app/src/main/java/com/example/cupcake/model/OrderViewModel.kt
0 → 100644
+
29
−
0
View file @
265f23b8
import
androidx.lifecycle.LiveData
import
androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.ViewModel
class
OrderViewModel
:
ViewModel
()
{
private
val
_quantity
=
MutableLiveData
<
Int
>(
0
)
val
quantity
:
LiveData
<
Int
>
=
_quantity
private
val
_flavor
=
MutableLiveData
<
String
>(
""
)
val
flavor
:
LiveData
<
String
>
=
_flavor
private
val
_date
=
MutableLiveData
<
String
>(
""
)
val
date
:
LiveData
<
String
>
=
_date
private
val
_price
=
MutableLiveData
<
Double
>(
0.0
)
val
price
:
LiveData
<
Double
>
=
_price
fun
setQuantity
(
numberCupcakes
:
Int
)
{
_quantity
.
value
=
numberCupcakes
}
fun
setFlavor
(
desiredFlavor
:
String
)
{
_flavor
.
value
=
desiredFlavor
}
fun
setDate
(
pickupDate
:
String
)
{
_date
.
value
=
pickupDate
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment