public class PacienteListAdapter extends android.support.v7.widget.RecyclerView.Adapter<PacienteListAdapter.ViewHolder>
En concreto, se encarga de mostrar el nombre de cada uno de los pacientes almacenados en la Base de Datos, que coincidan con los criterios de filtrado que se hayan introducido (si es que se ha introducido alguno), y notificar a PacientesPresenter cuando el usuario pulse sobre alguno de ellos.
PacientesPresenter
,
RecyclerView.ViewHolder
Modifier and Type | Class and Description |
---|---|
(package private) static class |
PacienteListAdapter.ViewHolder |
Constructor and Description |
---|
PacienteListAdapter(java.util.ArrayList<java.util.ArrayList<java.lang.String>> pacienteList,
android.os.Bundle args,
PacientesPresenter presenter)
Constructor principal del RecyclerView.Adapter para el RecyclerView
|
Modifier and Type | Method and Description |
---|---|
int |
getItemCount()
Returns the total number of items in the data set held by the adapter.
|
void |
onBindViewHolder(PacienteListAdapter.ViewHolder holder,
int position)
Called by RecyclerView to display the data at the specified position.
|
PacienteListAdapter.ViewHolder |
onCreateViewHolder(android.view.ViewGroup parent,
int viewType)
Metodo llamado para instanciar cada uno de los elementos del RecyclerView.Adapter
con su layout asociada (R.layout.paciente_miniatura, en este caso).
|
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 PacienteListAdapter(java.util.ArrayList<java.util.ArrayList<java.lang.String>> pacienteList, android.os.Bundle args, PacientesPresenter presenter)
pacienteList
- Listado de pacientes a mostrarargs
- Parametros en formato Bundlepresenter
- Presentador asociado con este RecyclerView.Adapterpublic PacienteListAdapter.ViewHolder onCreateViewHolder(android.view.ViewGroup parent, int viewType)
onCreateViewHolder
in class android.support.v7.widget.RecyclerView.Adapter<PacienteListAdapter.ViewHolder>
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(PacienteListAdapter.ViewHolder holder, int position)
RecyclerView.ViewHolder.itemView
to reflect the item at
the given position.
En concreto, se encarga de mostrar el nombre de cada uno de los pacientes almacenados en la Base de Datos, que coincidan con los criterios de filtrado que se hayan introducido (si es que se ha introducido alguno) y aƱadir a cada uno un evento de tipo OnClickListener, para notificar al Presentador cuando el usuario pulse sobre alguno de ellos.
onBindViewHolder
in class android.support.v7.widget.RecyclerView.Adapter<PacienteListAdapter.ViewHolder>
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 android.support.v7.widget.RecyclerView.Adapter<PacienteListAdapter.ViewHolder>