Class TaskAdapter


  • public class TaskAdapter
    extends RecyclerView.Adapter<edu.cnm.deepdive.teamassignmentsandroid.adapter.TaskAdapter.Holder>
    Adapter class that transfers task live data to the recycler view in the home fragment.
    • Method Detail

      • onCreateViewHolder

        @NonNull
        public edu.cnm.deepdive.teamassignmentsandroid.adapter.TaskAdapter.Holder onCreateViewHolder​(@NonNull
                                                                                                     ViewGroup parent,
                                                                                                     int viewType)
        Called when RecyclerView needs a new RecyclerView.ViewHolder of the given type to represent an item.
        Specified by:
        onCreateViewHolder in class RecyclerView.Adapter<edu.cnm.deepdive.teamassignmentsandroid.adapter.TaskAdapter.Holder>
        Parameters:
        parent - The view group is the base class for layouts and views containers
        viewType - default implementation of this method returns 0, making the assumption of a single view type for the adapter
        Returns:
        returns binding holder.
      • onBindViewHolder

        public void onBindViewHolder​(@NonNull
                                     edu.cnm.deepdive.teamassignmentsandroid.adapter.TaskAdapter.Holder holder,
                                     int position)
        Called by RecyclerView to display the data at the specified position.
        Specified by:
        onBindViewHolder in class RecyclerView.Adapter<edu.cnm.deepdive.teamassignmentsandroid.adapter.TaskAdapter.Holder>
        Parameters:
        holder - Creates a viewholder for data binding by the recyclerview
        position - will reflect the item at the given position
      • getItemCount

        public int getItemCount()
        Returns the total number of items in the data set held by the adapter.
        Specified by:
        getItemCount in class RecyclerView.Adapter<edu.cnm.deepdive.teamassignmentsandroid.adapter.TaskAdapter.Holder>
        Returns:
        task size.