public class QueueAdapter extends RecyclerView.Adapter<QueueAdapter.Holder>
List
<
MediaSessionCompat.QueueItem
>
adapter for a
RecyclerView
that each item's title, duration, and a play icon if it is the playing item.Modifier and Type | Class and Description |
---|---|
class |
QueueAdapter.Holder
Represents an entry in a
QueueAdapter . |
Constructor and Description |
---|
QueueAdapter(List<MediaSessionCompat.QueueItem> dataset,
String currentMediaId,
com.moppyandroid.main.QueueAdapter.ClickListener clickListener)
|
Modifier and Type | Method and Description |
---|---|
int |
getItemCount()
Gets the size of the data set.
|
void |
onBindViewHolder(QueueAdapter.Holder holder,
int position)
Method triggered when a
QueueAdapter.Holder is bound to the RecyclerView . |
QueueAdapter.Holder |
onCreateViewHolder(ViewGroup parent,
int viewType)
Method triggered when a
RecyclerView.ViewHolder is created. |
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
public QueueAdapter(List<MediaSessionCompat.QueueItem> dataset, String currentMediaId, com.moppyandroid.main.QueueAdapter.ClickListener clickListener)
dataset
- the List
to showpublic QueueAdapter.Holder onCreateViewHolder(ViewGroup parent, int viewType)
RecyclerView.ViewHolder
is created.onCreateViewHolder
in class RecyclerView.Adapter<QueueAdapter.Holder>
parent
- The ViewGroup into which the new View will be added after it is bound to
an adapter position.viewType
- The view type of the new View.RecyclerView.Adapter.getItemViewType(int)
,
#onBindViewHolder(ViewHolder, int)
public void onBindViewHolder(QueueAdapter.Holder holder, int position)
QueueAdapter.Holder
is bound to the RecyclerView
.onBindViewHolder
in class RecyclerView.Adapter<QueueAdapter.Holder>
holder
- The ViewHolder which should be updated to represent the contents of the
item at the given position in the data set.position
- The position of the item within the adapter's data set.public int getItemCount()
getItemCount
in class RecyclerView.Adapter<QueueAdapter.Holder>