Package com.xffffff.wellfed.common
Class EditItemAdapter<Item>
- java.lang.Object
-
- androidx.recyclerview.widget.RecyclerView.Adapter<androidx.recyclerview.widget.RecyclerView.ViewHolder>
-
- com.xffffff.wellfed.common.ItemAdapter<Item>
-
- com.xffffff.wellfed.common.EditItemAdapter<Item>
-
- Direct Known Subclasses:
EditIngredientAdapter
,EditRecipesAdapter
public abstract class EditItemAdapter<Item> extends ItemAdapter<Item>
Adapter that manages the view and data for the ingredients in theRecipe
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EditItemAdapter.ItemViewHolder
Viewholder for the itemsstatic interface
EditItemAdapter.OnDeleteListener<Item>
onDeleteListener is the interface that handles the delete buttonstatic interface
EditItemAdapter.OnEditListener<Item>
onEditListener is the interface that handles the edit button
-
Field Summary
Fields Modifier and Type Field Description protected EditItemAdapter.OnDeleteListener<Item>
deleteListener
deleteListener - the listener for deleting an itemprotected EditItemAdapter.OnEditListener<Item>
editListener
editListener - the listener for editing an item-
Fields inherited from class com.xffffff.wellfed.common.ItemAdapter
items
-
-
Constructor Summary
Constructors Constructor Description EditItemAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Boolean
getChanged()
getChanged - gets whether the items have changedjava.lang.Boolean
hasChanges()
hasChanged checks if the items have changedvoid
onBindViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder, int position)
onBindViewHolder - binds the view to the dataEditItemAdapter.ItemViewHolder
onCreateViewHolder(android.view.ViewGroup parent, int viewType)
inflates the viewvoid
setChanged(java.lang.Boolean changed)
setChanged - sets whether the items have changedvoid
setDeleteListener(EditItemAdapter.OnDeleteListener<Item> deleteListener)
setDeleteListener - sets the listener for deleting an itemvoid
setEditListener(EditItemAdapter.OnEditListener<Item> editListener)
setEditListener - sets the listener for editing an itemvoid
setItems(java.util.List<Item> items)
setItems - sets the items-
Methods inherited from class com.xffffff.wellfed.common.ItemAdapter
getItemCount, getItems
-
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
-
-
-
-
Field Detail
-
editListener
protected EditItemAdapter.OnEditListener<Item> editListener
editListener - the listener for editing an item
-
deleteListener
protected EditItemAdapter.OnDeleteListener<Item> deleteListener
deleteListener - the listener for deleting an item
-
-
Method Detail
-
getChanged
public java.lang.Boolean getChanged()
getChanged - gets whether the items have changed- Returns:
- whether the items have changed (True) or not (False)
-
setChanged
public void setChanged(java.lang.Boolean changed)
setChanged - sets whether the items have changed- Parameters:
changed
- whether the items have changed (True) or not (False)
-
setEditListener
public void setEditListener(EditItemAdapter.OnEditListener<Item> editListener)
setEditListener - sets the listener for editing an item- Parameters:
editListener
- the listener for editing an item
-
setDeleteListener
public void setDeleteListener(EditItemAdapter.OnDeleteListener<Item> deleteListener)
setDeleteListener - sets the listener for deleting an item- Parameters:
deleteListener
- the listener for deleting an item
-
onCreateViewHolder
@NonNull public EditItemAdapter.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
- the type of view- Returns:
- the view
-
onBindViewHolder
public void onBindViewHolder(@NonNull androidx.recyclerview.widget.RecyclerView.ViewHolder holder, int position)
onBindViewHolder - binds the view to the data- Specified by:
onBindViewHolder
in classandroidx.recyclerview.widget.RecyclerView.Adapter<androidx.recyclerview.widget.RecyclerView.ViewHolder>
- Parameters:
holder
- the view holderposition
- the position of the item
-
setItems
public void setItems(java.util.List<Item> items)
setItems - sets the items- Overrides:
setItems
in classItemAdapter<Item>
- Parameters:
items
- the items
-
hasChanges
public java.lang.Boolean hasChanges()
hasChanged checks if the items have changed- Returns:
- true if the items have changed
-
-