PacienteListAdapter

com.uva.rafael.tfg_goniometer.view.adapters

## Class PacienteListAdapter

- java.lang.Object
- - android.support.v7.widget.RecyclerView.Adapter<PacienteListAdapter.ViewHolder>
  - - com.uva.rafael.tfg_goniometer.view.adapters.PacienteListAdapter

-     public class PacienteListAdapter
      extends android.support.v7.widget.RecyclerView.Adapter<PacienteListAdapter.ViewHolder>

  Este es el `RecyclerView.Adapter` asociado al `RecyclerView` de `PacientesFragment`.

  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.

  Version:
    1.0
  Author:
    Rafael Matamoros Luque
  See Also:
    `PacientesPresenter`, `RecyclerView.ViewHolder`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `(package private) static class` | `PacienteListAdapter.ViewHolder`

  - ### Constructor Summary

    Constructors
    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`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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).

    - ### Methods inherited from class android.support.v7.widget.RecyclerView.Adapter

      `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`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PacienteListAdapter

          public 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`
      Parameters:
        `pacienteList` - Listado de pacientes a mostrar
        `args` - Parametros en formato `Bundle`
        `presenter` - Presentador asociado con este `RecyclerView.Adapter`

  - ### Method Detail

    - #### onCreateViewHolder

          public 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).
      Specified by:
        `onCreateViewHolder` in class `android.support.v7.widget.RecyclerView.Adapter<PacienteListAdapter.ViewHolder>`
      Parameters:
        `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.
      Returns:
        A new ViewHolder that holds a View of the given view type.
      See Also:
        `RecyclerView.Adapter.getItemViewType(int)`, `onBindViewHolder(ViewHolder, int)`

    - #### onBindViewHolder

          public void onBindViewHolder(PacienteListAdapter.ViewHolder holder,
                                       int position)

      Called by RecyclerView to display the data at the specified position. This method should update the contents of the `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.

      Specified by:
        `onBindViewHolder` in class `android.support.v7.widget.RecyclerView.Adapter<PacienteListAdapter.ViewHolder>`
      Parameters:
        `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.

    - #### getItemCount

          public int getItemCount()

      Returns the total number of items in the data set held by the adapter.
      Specified by:
        `getItemCount` in class `android.support.v7.widget.RecyclerView.Adapter<PacienteListAdapter.ViewHolder>`
      Returns:
        The total number of items in this adapter.