public class MedicionListAdapter extends android.support.v7.widget.RecyclerView.Adapter<MedicionListAdapter.ViewHolder>
En concreto, se encarga de mostrar toda la informacion relativa a las ultimas 10 mediciones que ha almacenado el usuario en la Base de Datos, y notificar a UltimasMedicionesPresenter cuando el usuario pulse sobre el boton para borrar la medicion en alguna de ellas.
UltimasMedicionesPresenter
,
RecyclerView.ViewHolder
Modifier and Type | Class and Description |
---|---|
(package private) static class |
MedicionListAdapter.ViewHolder |
Constructor and Description |
---|
MedicionListAdapter(java.util.ArrayList<java.util.ArrayList<java.lang.String>> medicionesList,
UltimasMedicionesPresenter 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(MedicionListAdapter.ViewHolder holder,
int position)
Called by RecyclerView to display the data at the specified position.
|
MedicionListAdapter.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.medicion_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 MedicionListAdapter(java.util.ArrayList<java.util.ArrayList<java.lang.String>> medicionesList, UltimasMedicionesPresenter presenter)
medicionesList
- Listado de mediciones a mostrarpresenter
- Presentador asociado con este RecyclerView.Adapterpublic MedicionListAdapter.ViewHolder onCreateViewHolder(android.view.ViewGroup parent, int viewType)
onCreateViewHolder
in class android.support.v7.widget.RecyclerView.Adapter<MedicionListAdapter.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(MedicionListAdapter.ViewHolder holder, int position)
RecyclerView.ViewHolder.itemView
to reflect the item at the given
position.
En concreto, se encarga de mostrar toda la informacion relativa a las ultimas 10 mediciones que ha almacenado el usuario en la Base de Datos, ademas de aƱadir un evento de tipo OnClickListener al boton para borrar la medicion, para notificar al Presentador cuando el usuario lo pulse.
onBindViewHolder
in class android.support.v7.widget.RecyclerView.Adapter<MedicionListAdapter.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<MedicionListAdapter.ViewHolder>