Class FacilityViewModel
java.lang.Object
androidx.lifecycle.ViewModel
com.example.slacks_lottoevent.viewmodel.FacilityViewModel
public class FacilityViewModel
extends androidx.lifecycle.ViewModel
FacilityViewModel is a class that provides the UI with the data it needs to display facilities.
-
Constructor Summary
ConstructorsConstructorDescriptionFacilityViewModel is a constructor that initializes the FacilityDB and sets the facility change listener. -
Method Summary
Modifier and TypeMethodDescriptionandroidx.lifecycle.LiveData<Facility>
getCurrentFacilityLiveData is a method that returns the current facility live data.getFacilitiesLiveData is a method that returns the facilities live data.void
updateFacility
(String name, String streetAddress) Create a new facility in Firestore if it doesn't already exist.Methods inherited from class androidx.lifecycle.ViewModel
addCloseable, onCleared
-
Constructor Details
-
FacilityViewModel
public FacilityViewModel()FacilityViewModel is a constructor that initializes the FacilityDB and sets the facility change listener.
-
-
Method Details
-
getFacilitiesLiveData
getFacilitiesLiveData is a method that returns the facilities live data.- Returns:
- the facilities live data.
-
getCurrentFacilityLiveData
getCurrentFacilityLiveData is a method that returns the current facility live data.- Returns:
- the current facility live data.
-
updateFacility
Create a new facility in Firestore if it doesn't already exist. Otherwise, update the existing facility.- Parameters:
name
- The name of the facilitystreetAddress
- The first line of the street address
-