public class MainViewModel extends AndroidViewModel implements LifecycleObserver
Constructor and Description |
---|
MainViewModel(Application application)
This is the constructor for the Main View Model.
|
Modifier and Type | Method and Description |
---|---|
void |
getDetails(long id)
This method is user to get the recipe details.
|
LiveData<RecipeDto> |
getSearchDetail() |
LiveData<List<RecipeDto>> |
getSearchResults()
This is the getter for the live data list of RecipeDto
|
LiveData<Throwable> |
getThrowable()
This is the getter for the live data Throwable
|
void |
search(String[] ingredients)
This method searches Spoonaculer using the string array of ingredients.
|
getApplication
public MainViewModel(@NonNull Application application)
application
- is a reference to the Application class.public LiveData<List<RecipeDto>> getSearchResults()
public LiveData<Throwable> getThrowable()
public void search(String[] ingredients)
ingredients
- is a String array inputted by the user.public void getDetails(long id)
id
- id the recipe id.