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>
PopulatesQuestion
s into a RecyclerView as specified by the accompanying item layout.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
QuestionItemAdapter.OnQuestionClickHelper
A helper class object to aid in going to a particularQuestion
details object.static interface
QuestionItemAdapter.OnQuestionDeleteHelper
A helper class to aid in deleting aQuestion
object.static interface
QuestionItemAdapter.OnQuestionEditHelper
A helper class to aid in editing aQuestion
object.-
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 int
getItemCount()
void
onBindViewHolder(edu.cnm.deepdive.interviewprep.adapter.QuestionItemAdapter.Holder holder, int position)
edu.cnm.deepdive.interviewprep.adapter.QuestionItemAdapter.Holder
onCreateViewHolder(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 ofQuestion
s to be populated into the RecyclerView.onQuestionEditHelper
- A helper class object to aid in editing aQuestion
object.onQuestionDeleteHelper
- A helper class object to aid in deleting aQuestion
object.onQuestionClickHelper
- A helper class object to aid in going to a particularQuestion
details object.
-
-
Method Detail
-
onCreateViewHolder
@NonNull public edu.cnm.deepdive.interviewprep.adapter.QuestionItemAdapter.Holder onCreateViewHolder(@NonNull ViewGroup parent, int viewType)
- Specified by:
onCreateViewHolder
in 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:
onBindViewHolder
in classRecyclerView.Adapter<edu.cnm.deepdive.interviewprep.adapter.QuestionItemAdapter.Holder>
-
getItemCount
public int getItemCount()
- Specified by:
getItemCount
in classRecyclerView.Adapter<edu.cnm.deepdive.interviewprep.adapter.QuestionItemAdapter.Holder>
-
-