public class DeviceAdapter extends RecyclerView.Adapter<DeviceAdapter.Holder>
List
<
UsbDevice
>
adapter for a RecyclerView
that displays a CheckBox
, one of the provided String
s, and an info icon as a list entry.Modifier and Type | Class and Description |
---|---|
class |
DeviceAdapter.Holder
Represents an entry in a
DeviceAdapter . |
Constructor and Description |
---|
DeviceAdapter(List<UsbDevice> dataset,
List<String> connectedIdentifiers,
com.moppyandroid.main.DeviceAdapter.InfoClickListener infoClickListener,
com.moppyandroid.main.DeviceAdapter.CheckBoxListener checkboxListener)
Constructs a
DeviceAdapter with a List of devices to display. |
Modifier and Type | Method and Description |
---|---|
int |
getItemCount()
Gets the size of the data set.
|
void |
onBindViewHolder(DeviceAdapter.Holder holder,
int position)
Method triggered when a
DeviceAdapter.Holder is bound to the RecyclerView . |
DeviceAdapter.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 DeviceAdapter(List<UsbDevice> dataset, List<String> connectedIdentifiers, com.moppyandroid.main.DeviceAdapter.InfoClickListener infoClickListener, com.moppyandroid.main.DeviceAdapter.CheckBoxListener checkboxListener)
DeviceAdapter
with a List
of devices to display.dataset
- the List
to showpublic DeviceAdapter.Holder onCreateViewHolder(ViewGroup parent, int viewType)
RecyclerView.ViewHolder
is created.onCreateViewHolder
in class RecyclerView.Adapter<DeviceAdapter.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(DeviceAdapter.Holder holder, int position)
DeviceAdapter.Holder
is bound to the RecyclerView
.onBindViewHolder
in class RecyclerView.Adapter<DeviceAdapter.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<DeviceAdapter.Holder>