Class IngredientSearchAdapter

    • Constructor Detail

      • IngredientSearchAdapter

        public IngredientSearchAdapter​(IngredientDB db)
        Creates a new RecipeIngredientSearchAdapter
        Parameters:
        db - the Ingredient database that the adapter is connected to
    • Method Detail

      • changeQuery

        public void changeQuery​(java.lang.String field)
      • onCreateViewHolder

        @NonNull
        public IngredientSearchAdapter.ViewHolder onCreateViewHolder​(@NonNull
                                                                     android.view.ViewGroup parent,
                                                                     int viewType)
        Inflate the layout of a single View into the parent ViewGroup
        Specified by:
        onCreateViewHolder in class androidx.recyclerview.widget.RecyclerView.Adapter<IngredientSearchAdapter.ViewHolder>
        Parameters:
        parent - the parent ViewGroup to inflate the layout in
        viewType - an identifier for the view type
        Returns:
        the new ViewHolder for a Recipe created
      • onBindViewHolder

        public void onBindViewHolder​(@NonNull
                                     IngredientSearchAdapter.ViewHolder holder,
                                     int position)
        Bind the data with the views in the RecyclerView
        Specified by:
        onBindViewHolder in class androidx.recyclerview.widget.RecyclerView.Adapter<IngredientSearchAdapter.ViewHolder>
        Parameters:
        holder - the ViewHolder which holds Views to be bound to the recipe
        position - the position of the View in the ViewHolder to bind the data to
      • setListener

        public void setListener​(OnItemClickListener listener)
        Sets the on-click listener for the RecyclerView
        Parameters:
        listener - the on-click listener that will be notified when an item is clicked