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 interfaceInterface for listening to changes in the events in the Firestore database. -
Method Summary
Modifier and TypeMethodDescriptionstatic EventDBReturns the singleton instance of EventDB.voidNotifies the EventChangeListener that the events have changed.voidSets the EventChangeListener for this EventDB.voidStarts listening for Firestore updates for the events collection.voidStops listening to the events in the Firestore database.voidupdateEvent(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
-