Class ScaleRecyclerAdapter
- java.lang.Object
-
- androidx.recyclerview.widget.RecyclerView.Adapter<edu.cnm.deepdive.scalescroller.adapter.ScaleRecyclerAdapter.Holder>
-
- edu.cnm.deepdive.scalescroller.adapter.ScaleRecyclerAdapter
-
public class ScaleRecyclerAdapter extends RecyclerView.Adapter<edu.cnm.deepdive.scalescroller.adapter.ScaleRecyclerAdapter.Holder>
Allows for the scales in the database to be listed in a RecyclerView.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ScaleRecyclerAdapter.OnScaleClickListener
This interface can be implemented to handle clicks of scales in the adapter.
-
Constructor Summary
Constructors Constructor Description ScaleRecyclerAdapter(Context context, List<Scale> scales, ScaleRecyclerAdapter.OnScaleClickListener listener, int highestDifficulty)
The constructor initializes the context, the list of scales, an onClickListener, and the highest difficulty scale the current player has access to.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getItemCount()
void
onBindViewHolder(edu.cnm.deepdive.scalescroller.adapter.ScaleRecyclerAdapter.Holder holder, int position)
edu.cnm.deepdive.scalescroller.adapter.ScaleRecyclerAdapter.Holder
onCreateViewHolder(ViewGroup parent, int viewType)
-
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
-
-
-
-
Constructor Detail
-
ScaleRecyclerAdapter
public ScaleRecyclerAdapter(@NonNull Context context, List<Scale> scales, ScaleRecyclerAdapter.OnScaleClickListener listener, int highestDifficulty)
The constructor initializes the context, the list of scales, an onClickListener, and the highest difficulty scale the current player has access to.- Parameters:
context
- The application context.scales
- AList
ofScale
to be displayed.listener
- A type of onClickListener.highestDifficulty
- The highest difficulty scale the current player has access to.
-
-
Method Detail
-
onCreateViewHolder
@NonNull public edu.cnm.deepdive.scalescroller.adapter.ScaleRecyclerAdapter.Holder onCreateViewHolder(@NonNull ViewGroup parent, int viewType)
- Specified by:
onCreateViewHolder
in classRecyclerView.Adapter<edu.cnm.deepdive.scalescroller.adapter.ScaleRecyclerAdapter.Holder>
-
onBindViewHolder
public void onBindViewHolder(@NonNull edu.cnm.deepdive.scalescroller.adapter.ScaleRecyclerAdapter.Holder holder, int position)
- Specified by:
onBindViewHolder
in classRecyclerView.Adapter<edu.cnm.deepdive.scalescroller.adapter.ScaleRecyclerAdapter.Holder>
-
getItemCount
public int getItemCount()
- Specified by:
getItemCount
in classRecyclerView.Adapter<edu.cnm.deepdive.scalescroller.adapter.ScaleRecyclerAdapter.Holder>
-
-