com.virtual.tour.road.com.virtual.tour.road.model

## Class GestorPreIniReproductorMusica

- java.lang.Object
- - com.virtual.tour.road.com.virtual.tour.road.model.GestorPreIniReproductorMusica

- All Implemented Interfaces:
    android.location.LocationListener

      public class GestorPreIniReproductorMusica
      extends java.lang.Object
      implements android.location.LocationListener

  Created by Carolina Bonnin on 01/06/2015. Clase para gestionar las distintas opciones antes de iniciar el reproductor de musica.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private android.content.Context` | `context`
    `protected android.location.Location` | `currentLocation`
    `(package private) android.os.Handler` | `handler`
    `protected android.location.LocationListener` | `locationListener`
    `protected android.location.LocationManager` | `locationManager`
    `private boolean` | `propia`
    `private java.util.ArrayList<Song>` | `songList`
    `private java.util.Timer` | `timer`
    `private java.util.TimerTask` | `timerTask`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GestorPreIniReproductorMusica(android.content.Context c)` Obtenemos el context mediante el constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `crearDialogLocalizacion()` Funcion que crea el Dialog para pedir permisos para localizar al usuario.
    `void` | `createDummyDataForDB(MySQLiteHelper db)` Creamos los usuarios ficticios con sus canciones en posiciones ficticias
    `android.app.Dialog` | `generarDialog()` Funcion para generar el Dialog para seleccionar una playlist u otra.
    `android.location.Location` | `getCurrentLocation()`
    `void` | `getDBSongs()` Creamos el listado de canciones de otros usuarios y lo seteamos
    `void` | `getSongList()` Metodo para obtener el listado de canciones del dispositivo.
    `void` | `initializeTimerTask()`
    `void` | `onLocationChanged(android.location.Location location)` Called when the location has changed.
    `void` | `onProviderDisabled(java.lang.String provider)` Called when the provider is disabled by the user.
    `void` | `onProviderEnabled(java.lang.String provider)` Called when the provider is enabled by the user.
    `void` | `onStatusChanged(java.lang.String provider, int status, android.os.Bundle extras)` Called when the provider status changes.
    `void` | `setCurrentLocation(android.location.Location cL)`
    `void` | `sortSongs()` Ordenamos las canciones segun proximidad
    `void` | `startTimer()`
    `void` | `stopTimerTask()`

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

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

- - ### Field Detail

    - #### context

          private android.content.Context context

    - #### currentLocation

          protected android.location.Location currentLocation

    - #### handler

          final android.os.Handler handler

    - #### locationListener

          protected android.location.LocationListener locationListener

    - #### locationManager

          protected android.location.LocationManager locationManager

    - #### propia

          private boolean propia

    - #### songList

          private java.util.ArrayList<Song> songList

    - #### timer

          private java.util.Timer timer

    - #### timerTask

          private java.util.TimerTask timerTask

  - ### Constructor Detail

    - #### GestorPreIniReproductorMusica

          public GestorPreIniReproductorMusica(android.content.Context c)

      Obtenemos el context mediante el constructor.
      Parameters:
        `c` - contexto de la activity que llama al constructor.

  - ### Method Detail

    - #### crearDialogLocalizacion

          public void crearDialogLocalizacion()

      Funcion que crea el Dialog para pedir permisos para localizar al usuario. En caso de que acepte, se le mostrara la lista ordenada de canciones segun distancia. En caso negativo, se le mostrará la playlist de su dispositivo.

    - #### createDummyDataForDB

          public void createDummyDataForDB(MySQLiteHelper db)

      Creamos los usuarios ficticios con sus canciones en posiciones ficticias
      Parameters:
        `db` - dataBase

    - #### generarDialog

          public android.app.Dialog generarDialog()

      Funcion para generar el Dialog para seleccionar una playlist u otra.
      Returns:
        el dialog construido

    - #### getCurrentLocation

          public android.location.Location getCurrentLocation()

    - #### getDBSongs

          public void getDBSongs()

      Creamos el listado de canciones de otros usuarios y lo seteamos

    - #### getSongList

          public void getSongList()

      Metodo para obtener el listado de canciones del dispositivo.

    - #### initializeTimerTask

          public void initializeTimerTask()

    - #### onLocationChanged

          public void onLocationChanged(android.location.Location location)

      Description copied from interface: `android.location.LocationListener`
      Called when the location has changed.

      There are no restrictions on the use of the supplied Location object.

      Specified by:
        `onLocationChanged` in interface `android.location.LocationListener`
      Parameters:
        `location` - The new location, as a Location object.

    - #### onProviderDisabled

          public void onProviderDisabled(java.lang.String provider)

      Description copied from interface: `android.location.LocationListener`
      Called when the provider is disabled by the user. If requestLocationUpdates is called on an already disabled provider, this method is called immediately.
      Specified by:
        `onProviderDisabled` in interface `android.location.LocationListener`
      Parameters:
        `provider` - the name of the location provider associated with this update.

    - #### onProviderEnabled

          public void onProviderEnabled(java.lang.String provider)

      Description copied from interface: `android.location.LocationListener`
      Called when the provider is enabled by the user.
      Specified by:
        `onProviderEnabled` in interface `android.location.LocationListener`
      Parameters:
        `provider` - the name of the location provider associated with this update.

    - #### onStatusChanged

          public void onStatusChanged(java.lang.String provider,
                                      int status,
                                      android.os.Bundle extras)

      Description copied from interface: `android.location.LocationListener`
      Called when the provider status changes. This method is called when a provider is unable to fetch a location or if the provider has recently become available after a period of unavailability.
      Specified by:
        `onStatusChanged` in interface `android.location.LocationListener`
      Parameters:
        `provider` - the name of the location provider associated with this update.
        `status` - `LocationProvider.OUT_OF_SERVICE` if the provider is out of service, and this is not expected to change in the near future; `LocationProvider.TEMPORARILY_UNAVAILABLE` if the provider is temporarily unavailable but is expected to be available shortly; and `LocationProvider.AVAILABLE` if the provider is currently available.
        `extras` - an optional Bundle which will contain provider specific status variables.

        A number of common key/value pairs for the extras Bundle are listed below. Providers that use any of the keys on this list must provide the corresponding value as described below.

        - satellites - the number of satellites used to derive the fix

    - #### setCurrentLocation

          public void setCurrentLocation(android.location.Location cL)

    - #### sortSongs

          public void sortSongs()

      Ordenamos las canciones segun proximidad

    - #### startTimer

          public void startTimer()

    - #### stopTimerTask

          public void stopTimerTask()