Package com.xffffff.wellfed.ingredient
Class IngredientSearchAdapter
- java.lang.Object
-
- androidx.recyclerview.widget.RecyclerView.Adapter<VH>
-
- com.xffffff.wellfed.common.DBAdapter<IngredientSearchAdapter.ViewHolder>
-
- com.xffffff.wellfed.ingredient.IngredientSearchAdapter
-
- All Implemented Interfaces:
com.google.firebase.firestore.EventListener<com.google.firebase.firestore.QuerySnapshot>
public class IngredientSearchAdapter extends DBAdapter<IngredientSearchAdapter.ViewHolder>
Adapter that connects the RecyclerView and data for the ingredients in theIngredientSearchActivity
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
IngredientSearchAdapter.ViewHolder
Holds the views for the ingredients in the search-
Nested classes/interfaces inherited from class com.xffffff.wellfed.common.DBAdapter
DBAdapter.OnDataChangedListener
-
-
Constructor Summary
Constructors Constructor Description IngredientSearchAdapter(IngredientDB db)
Creates a new RecipeIngredientSearchAdapter
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
changeQuery(java.lang.String field)
void
onBindViewHolder(IngredientSearchAdapter.ViewHolder holder, int position)
Bind the data with the views in the RecyclerViewIngredientSearchAdapter.ViewHolder
onCreateViewHolder(android.view.ViewGroup parent, int viewType)
Inflate the layout of a single View into the parent ViewGroupvoid
setListener(OnItemClickListener listener)
Sets the on-click listener for the RecyclerView-
Methods inherited from class com.xffffff.wellfed.common.DBAdapter
getItemCount, getSnapshot, getSnapshots, onDataChanged, onEvent, setOnDataChangedListener, setQuery, startListening, stopListening
-
Methods inherited from class androidx.recyclerview.widget.RecyclerView.Adapter
bindViewHolder, createViewHolder, getItemId, getItemViewType, hasObservers, hasStableIds, notifyDataSetChanged, notifyItemChanged, notifyItemChanged, notifyItemInserted, notifyItemMoved, notifyItemRangeChanged, notifyItemRangeChanged, notifyItemRangeInserted, notifyItemRangeRemoved, notifyItemRemoved, onAttachedToRecyclerView, onBindViewHolder, onDetachedFromRecyclerView, onFailedToRecycleView, onViewAttachedToWindow, onViewDetachedFromWindow, onViewRecycled, registerAdapterDataObserver, setHasStableIds, unregisterAdapterDataObserver
-
-
-
-
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 classandroidx.recyclerview.widget.RecyclerView.Adapter<IngredientSearchAdapter.ViewHolder>
- Parameters:
parent
- the parent ViewGroup to inflate the layout inviewType
- 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 classandroidx.recyclerview.widget.RecyclerView.Adapter<IngredientSearchAdapter.ViewHolder>
- Parameters:
holder
- the ViewHolder which holds Views to be bound to the recipeposition
- 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
-
-