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 Details

    • ProfileViewModel

      public ProfileViewModel()
      Constructor for the ProfileViewModel. Initializes the ProfileDB and sets the listener for profile changes.
  • Method Details

    • getProfilesLiveData

      public androidx.lifecycle.LiveData<HashMap<String,Profile>> getProfilesLiveData()
      Returns the profiles LiveData.
      Returns:
      The profiles LiveData.
    • getCurrentProfileLiveData

      public androidx.lifecycle.LiveData<Profile> getCurrentProfileLiveData()
      Returns the current profile LiveData.
      Returns:
      The current profile LiveData.
    • updateProfile

      public void updateProfile(Profile profile)
      Adds a new profile to Firestore.
      Parameters:
      profile - The profile to add.