Class ProfileViewModel
java.lang.Object
androidx.lifecycle.ViewModel
com.example.slacks_lottoevent.viewmodel.ProfileViewModel
public class ProfileViewModel
extends androidx.lifecycle.ViewModel
ViewModel for the ProfileFragment. Manages the current profile and all profiles in Firestore.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionandroidx.lifecycle.LiveData<Profile>
Returns the current profile LiveData.Returns the profiles LiveData.void
updateProfile
(Profile profile) Adds a new profile to Firestore.Methods inherited from class androidx.lifecycle.ViewModel
addCloseable, onCleared
-
Constructor Details
-
ProfileViewModel
public ProfileViewModel()Constructor for the ProfileViewModel. Initializes the ProfileDB and sets the listener for profile changes.
-
-
Method Details
-
getProfilesLiveData
Returns the profiles LiveData.- Returns:
- The profiles LiveData.
-
getCurrentProfileLiveData
Returns the current profile LiveData.- Returns:
- The current profile LiveData.
-
updateProfile
Adds a new profile to Firestore.- Parameters:
profile
- The profile to add.
-