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 Details

    • FacilityViewModel

      public FacilityViewModel()
      FacilityViewModel is a constructor that initializes the FacilityDB and sets the facility change listener.
  • Method Details

    • getFacilitiesLiveData

      public androidx.lifecycle.LiveData<HashMap<String,Facility>> getFacilitiesLiveData()
      getFacilitiesLiveData is a method that returns the facilities live data.
      Returns:
      the facilities live data.
    • getCurrentFacilityLiveData

      public androidx.lifecycle.LiveData<Facility> getCurrentFacilityLiveData()
      getCurrentFacilityLiveData is a method that returns the current facility live data.
      Returns:
      the current facility live data.
    • updateFacility

      public void updateFacility(String name, String streetAddress)
      Create a new facility in Firestore if it doesn't already exist. Otherwise, update the existing facility.
      Parameters:
      name - The name of the facility
      streetAddress - The first line of the street address