Class IngredientStorageController


  • public class IngredientStorageController
    extends java.lang.Object
    The IngredientStorageController class is a controller for the IngredientStorageActivity.
    • Constructor Detail

      • IngredientStorageController

        public IngredientStorageController​(androidx.fragment.app.FragmentActivity activity)
        Creates ingredients list that represents an empty food storage.
        Parameters:
        activity - the activity that is using this controller
    • Method Detail

      • getAdapter

        public StorageIngredientAdapter getAdapter()
        Gets the adapter that is used to display the ingredients in the list view.
        Returns:
        the adapter that is used to display the ingredients in the list view
      • deleteIngredient

        public void deleteIngredient​(StorageIngredient storageIngredient)
        Deletes StorageIngredient from adapter
        Parameters:
        storageIngredient - the StorageIngredient object to delete
      • addIngredient

        public void addIngredient​(StorageIngredient storageIngredient)
        Adds an StorageIngredient to adapter
        Parameters:
        storageIngredient - the StorageIngredient object to add
      • updateIngredient

        public void updateIngredient​(StorageIngredient storageIngredient)
        Update StorageIngredient in adapter
        Parameters:
        storageIngredient - the StorageIngredient object to update
      • getSortedResults

        public void getSortedResults​(java.lang.String field)
        Gets the DB of ingredients sorted by field
        Parameters:
        field - the field to sort by description | category | expiration
      • getSearchResults

        public void getSearchResults​(java.lang.String field)
        Get the search results from the DB
        Parameters:
        field - the field to search by