Package com.xffffff.wellfed.mealplan
Class MealPlanItemAdapter<Item>
- java.lang.Object
-
- androidx.recyclerview.widget.RecyclerView.Adapter<androidx.recyclerview.widget.RecyclerView.ViewHolder>
-
- com.xffffff.wellfed.common.ItemAdapter<Item>
-
- com.xffffff.wellfed.mealplan.MealPlanItemAdapter<Item>
-
- Type Parameters:
Item
- The type of item in the ArrayList.
- Direct Known Subclasses:
MealPlanIngredientItemAdapter
,MealPlanRecipeItemAdapter
public abstract class MealPlanItemAdapter<Item> extends ItemAdapter<Item>
The MealPlanItemAdapter class binds ArrayList to RecyclerView.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MealPlanItemAdapter.ItemViewHolder
ItemViewHolder class holds the view for the item.
-
Field Summary
-
Fields inherited from class com.xffffff.wellfed.common.ItemAdapter
items
-
-
Constructor Summary
Constructors Constructor Description MealPlanItemAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onBindViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder, int position)
onBindViewHolder method binds a MealPlan object and a MealPlanViewHolder object.MealPlanItemAdapter.ItemViewHolder
onCreateViewHolder(android.view.ViewGroup parent, int viewType)
inflates the viewvoid
setOnItemClickListener(OnItemClickListener<Item> onItemClickListener)
Sets the listener for an item click in the Recyclerview-
Methods inherited from class com.xffffff.wellfed.common.ItemAdapter
getItemCount, getItems, setItems
-
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
-
-
-
-
Method Detail
-
onCreateViewHolder
@NonNull public MealPlanItemAdapter.ItemViewHolder onCreateViewHolder(@NonNull android.view.ViewGroup parent, int viewType)
inflates the view- Specified by:
onCreateViewHolder
in classandroidx.recyclerview.widget.RecyclerView.Adapter<androidx.recyclerview.widget.RecyclerView.ViewHolder>
- Parameters:
parent
- activity that handles the ingredientsviewType
- type of view- Returns:
- the view
-
onBindViewHolder
public void onBindViewHolder(@NonNull androidx.recyclerview.widget.RecyclerView.ViewHolder holder, int position)
onBindViewHolder method binds a MealPlan object and a MealPlanViewHolder object.- Specified by:
onBindViewHolder
in classandroidx.recyclerview.widget.RecyclerView.Adapter<androidx.recyclerview.widget.RecyclerView.ViewHolder>
- Parameters:
holder
- the view holderposition
- the position of the item in the ArrayList
-
setOnItemClickListener
public void setOnItemClickListener(OnItemClickListener<Item> onItemClickListener)
Sets the listener for an item click in the Recyclerview- Parameters:
onItemClickListener
- the listener to set
-
-