Class EditItemAdapter<Item>

    • 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 changed
      java.lang.Boolean hasChanges()
      hasChanged checks if the items have changed
      void onBindViewHolder​(androidx.recyclerview.widget.RecyclerView.ViewHolder holder, int position)
      onBindViewHolder - binds the view to the data
      EditItemAdapter.ItemViewHolder onCreateViewHolder​(android.view.ViewGroup parent, int viewType)
      inflates the view
      void setChanged​(java.lang.Boolean changed)
      setChanged - sets whether the items have changed
      void setDeleteListener​(EditItemAdapter.OnDeleteListener<Item> deleteListener)
      setDeleteListener - sets the listener for deleting an item
      void setEditListener​(EditItemAdapter.OnEditListener<Item> editListener)
      setEditListener - sets the listener for editing an item
      void setItems​(java.util.List<Item> items)
      setItems - sets the items
      • 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EditItemAdapter

        public EditItemAdapter()
    • 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 class androidx.recyclerview.widget.RecyclerView.Adapter<androidx.recyclerview.widget.RecyclerView.ViewHolder>
        Parameters:
        parent - activity that handles the ingredients
        viewType - 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 class androidx.recyclerview.widget.RecyclerView.Adapter<androidx.recyclerview.widget.RecyclerView.ViewHolder>
        Parameters:
        holder - the view holder
        position - the position of the item
      • setItems

        public void setItems​(java.util.List<Item> items)
        setItems - sets the items
        Overrides:
        setItems in class ItemAdapter<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