Package com.example.breeze_seas
Class SessionViewModel
java.lang.Object
androidx.lifecycle.ViewModel
com.example.breeze_seas.SessionViewModel
public class SessionViewModel
extends androidx.lifecycle.ViewModel
This class allows data to be shared between different fragments
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionandroidx.lifecycle.MutableLiveData<String> Returns the current android IDandroidx.lifecycle.MutableLiveData<Event> Gets the event object that will be presented in the EventDetails Fragmentandroidx.lifecycle.MutableLiveData<User> getUser()Return the curernt user objectvoidsetAndroidID(String id) Set android IDvoidsetEventShown(Event eventShown) Sets the event object for EventDetailsFragment to displayvoidSet the current user objectMethods inherited from class androidx.lifecycle.ViewModel
addCloseable, onCleared
-
Constructor Details
-
SessionViewModel
public SessionViewModel()
-
-
Method Details
-
getAndroidID
Returns the current android ID- Returns:
- String of current device AndroidID
-
setAndroidID
Set android ID- Parameters:
id- The id to set the Android ID as
-
getUser
Return the curernt user object- Returns:
- The user object to set as current user
-
setUser
Set the current user object- Parameters:
userInstance- The user object pertaining to the current user
-
getEventShown
Gets the event object that will be presented in the EventDetails Fragment- Returns:
- The event object to be displayed
-
setEventShown
Sets the event object for EventDetailsFragment to display- Parameters:
eventShown- The event object to show
-