Class EventViewModel

java.lang.Object
androidx.lifecycle.ViewModel
com.example.slacks_lottoevent.viewmodel.EventViewModel

public class EventViewModel extends androidx.lifecycle.ViewModel
EventViewModel is a class that provides the UI with the data it needs to display events.
  • Constructor Details

    • EventViewModel

      public EventViewModel()
      EventViewModel is a constructor that initializes the EventDB and sets the event change listener.
  • Method Details

    • getEventsLiveData

      public androidx.lifecycle.LiveData<HashMap<String,Event>> getEventsLiveData()
      getEventsLiveData is a method that returns the events live data.
      Returns:
      the events live data.
    • getEntrantEventsLiveData

      public androidx.lifecycle.LiveData<List<Event>> getEntrantEventsLiveData()
      getEntrantEventsLiveData is a method that returns the entrant events live data.
      Returns:
      the entrant events live data.
    • getHostingEventsLiveData

      public androidx.lifecycle.LiveData<List<Event>> getHostingEventsLiveData()
      getHostingEventsLiveData is a method that returns the hosting events live data.
      Returns:
      the hosting events live data.
    • updateEventLists

      public void updateEventLists(List<String> waitlistedIds, List<String> unselectedIds, List<String> invitedIds, List<String> attendingIds)
      updateEventLists is a method that updates the entrant events live data.
      Parameters:
      waitlistedIds - is a list of waitlisted event IDs.
      unselectedIds - is a list of unselected event IDs.
      invitedIds - is a list of invited event IDs.
      attendingIds - is a list of attending event IDs.
    • updateOrganizerEvents

      public void updateOrganizerEvents(List<String> eventIds)
      updateOrganizerEvents is a method that updates the hosting events live data.
      Parameters:
      eventIds - is a list of event IDs.
    • updateEvent

      public void updateEvent(Event event)
      addEvent is a method that adds an event to the database.
      Parameters:
      event - is an event to add.