Class QuestionItemAdapter
- java.lang.Object
-
- androidx.recyclerview.widget.RecyclerView.Adapter<edu.cnm.deepdive.interviewprep.adapter.QuestionItemAdapter.Holder>
-
- edu.cnm.deepdive.interviewprep.adapter.QuestionItemAdapter
-
public class QuestionItemAdapter extends RecyclerView.Adapter<edu.cnm.deepdive.interviewprep.adapter.QuestionItemAdapter.Holder>
PopulatesQuestions into a RecyclerView as specified by the accompanying item layout.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceQuestionItemAdapter.OnQuestionClickHelperA helper class object to aid in going to a particularQuestiondetails object.static interfaceQuestionItemAdapter.OnQuestionDeleteHelperA helper class to aid in deleting aQuestionobject.static interfaceQuestionItemAdapter.OnQuestionEditHelperA helper class to aid in editing aQuestionobject.-
Nested classes/interfaces inherited from class androidx.recyclerview.widget.RecyclerView.Adapter
RecyclerView.Adapter.StateRestorationPolicy
-
-
Constructor Summary
Constructors Constructor Description QuestionItemAdapter(Context context, List<Question> questions, QuestionItemAdapter.OnQuestionEditHelper onQuestionEditHelper, QuestionItemAdapter.OnQuestionDeleteHelper onQuestionDeleteHelper, QuestionItemAdapter.OnQuestionClickHelper onQuestionClickHelper)Class constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetItemCount()voidonBindViewHolder(edu.cnm.deepdive.interviewprep.adapter.QuestionItemAdapter.Holder holder, int position)edu.cnm.deepdive.interviewprep.adapter.QuestionItemAdapter.HolderonCreateViewHolder(ViewGroup parent, int viewType)-
Methods inherited from class androidx.recyclerview.widget.RecyclerView.Adapter
bindViewHolder, createViewHolder, findRelativeAdapterPositionIn, getItemId, getItemViewType, getStateRestorationPolicy, hasObservers, hasStableIds, notifyDataSetChanged, notifyItemChanged, notifyItemChanged, notifyItemInserted, notifyItemMoved, notifyItemRangeChanged, notifyItemRangeChanged, notifyItemRangeInserted, notifyItemRangeRemoved, notifyItemRemoved, onAttachedToRecyclerView, onBindViewHolder, onDetachedFromRecyclerView, onFailedToRecycleView, onViewAttachedToWindow, onViewDetachedFromWindow, onViewRecycled, registerAdapterDataObserver, setHasStableIds, setStateRestorationPolicy, unregisterAdapterDataObserver
-
-
-
-
Constructor Detail
-
QuestionItemAdapter
public QuestionItemAdapter(Context context, List<Question> questions, QuestionItemAdapter.OnQuestionEditHelper onQuestionEditHelper, QuestionItemAdapter.OnQuestionDeleteHelper onQuestionDeleteHelper, QuestionItemAdapter.OnQuestionClickHelper onQuestionClickHelper)
Class constructor. Initializes local variables.- Parameters:
context- The context.questions- A list ofQuestions to be populated into the RecyclerView.onQuestionEditHelper- A helper class object to aid in editing aQuestionobject.onQuestionDeleteHelper- A helper class object to aid in deleting aQuestionobject.onQuestionClickHelper- A helper class object to aid in going to a particularQuestiondetails object.
-
-
Method Detail
-
onCreateViewHolder
@NonNull public edu.cnm.deepdive.interviewprep.adapter.QuestionItemAdapter.Holder onCreateViewHolder(@NonNull ViewGroup parent, int viewType)
- Specified by:
onCreateViewHolderin classRecyclerView.Adapter<edu.cnm.deepdive.interviewprep.adapter.QuestionItemAdapter.Holder>
-
onBindViewHolder
public void onBindViewHolder(@NonNull edu.cnm.deepdive.interviewprep.adapter.QuestionItemAdapter.Holder holder, int position)
- Specified by:
onBindViewHolderin classRecyclerView.Adapter<edu.cnm.deepdive.interviewprep.adapter.QuestionItemAdapter.Holder>
-
getItemCount
public int getItemCount()
- Specified by:
getItemCountin classRecyclerView.Adapter<edu.cnm.deepdive.interviewprep.adapter.QuestionItemAdapter.Holder>
-
-