Class EventDB
java.lang.Object
com.example.slacks_lottoevent.database.EventDB
EventDB is a singleton class that manages the events in the Firestore database.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Interface for listening to changes in the events in the Firestore database. -
Method Summary
Modifier and TypeMethodDescriptionstatic EventDB
Returns the singleton instance of EventDB.void
Notifies the EventChangeListener that the events have changed.void
Sets the EventChangeListener for this EventDB.void
Starts listening for Firestore updates for the events collection.void
Stops listening to the events in the Firestore database.void
updateEvent
(Event event) Adds an event to the Firestore database.
-
Method Details
-
getInstance
Returns the singleton instance of EventDB.- Returns:
- the singleton instance of EventDB
-
startListening
public void startListening()Starts listening for Firestore updates for the events collection. -
stopListening
public void stopListening()Stops listening to the events in the Firestore database. -
setEventChangeListener
Sets the EventChangeListener for this EventDB.- Parameters:
listener
- the EventChangeListener to set
-
notifyEventChangeListener
public void notifyEventChangeListener()Notifies the EventChangeListener that the events have changed. -
updateEvent
Adds an event to the Firestore database.- Parameters:
event
- the event to add
-