public class SoftListAdapter extends androidx.recyclerview.widget.RecyclerView.Adapter<SoftListAdapter.MyViewHolder>
Modifier and Type | Class and Description |
---|---|
static class |
SoftListAdapter.MyViewHolder
Each data item is just a string in this case
|
Modifier and Type | Field and Description |
---|---|
private java.util.ArrayList<java.lang.String> |
mDataset |
Constructor and Description |
---|
SoftListAdapter(java.util.ArrayList<java.lang.String> myDataset)
Provide a suitable constructor (depends on the kind of dataset)
|
Modifier and Type | Method and Description |
---|---|
void |
filterList(java.util.ArrayList<java.lang.String> filterdNames)
Provide a reference to the views for each data item
Complex data items may need more than one view per item, and
you provide access to all the views for a data item in a view holder
|
int |
getItemCount()
Return the size of your dataset (invoked by the layout manager)
and assigning it to the list with notifydatasetchanged method
|
void |
onBindViewHolder(SoftListAdapter.MyViewHolder holder,
int position)
Replace the contents of a view (invoked by the layout manager)
|
SoftListAdapter.MyViewHolder |
onCreateViewHolder(android.view.ViewGroup parent,
int viewType)
Create new views (invoked by the layout manager)
|
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 SoftListAdapter(java.util.ArrayList<java.lang.String> myDataset)
myDataset
- ArrayList Data Setpublic void filterList(java.util.ArrayList<java.lang.String> filterdNames)
filterdNames
- filetered listpublic int getItemCount()
getItemCount
in class androidx.recyclerview.widget.RecyclerView.Adapter<SoftListAdapter.MyViewHolder>
public void onBindViewHolder(SoftListAdapter.MyViewHolder holder, int position)
onBindViewHolder
in class androidx.recyclerview.widget.RecyclerView.Adapter<SoftListAdapter.MyViewHolder>
holder
- replace the contents of the view with that elementposition
- get element from your dataset at this positionpublic SoftListAdapter.MyViewHolder onCreateViewHolder(android.view.ViewGroup parent, int viewType)
onCreateViewHolder
in class androidx.recyclerview.widget.RecyclerView.Adapter<SoftListAdapter.MyViewHolder>