com.virtual.tour.road.com.virtual.tour.road.vista

## Class PathGoogleMapActivity

- java.lang.Object
- - android.content.Context
  - - android.content.ContextWrapper
    - - android.view.ContextThemeWrapper
      - - android.app.Activity
        - - android.support.v4.app.FragmentActivity
          - - com.virtual.tour.road.com.virtual.tour.road.vista.PathGoogleMapActivity

- All Implemented Interfaces:
    android.content.ComponentCallbacks, android.content.ComponentCallbacks2, android.view.KeyEvent.Callback, android.view.LayoutInflater.Factory, android.view.LayoutInflater.Factory2, android.view.View.OnCreateContextMenuListener, android.view.Window.Callback, android.view.Window.OnWindowDismissedCallback

      public class PathGoogleMapActivity
      extends android.support.v4.app.FragmentActivity

  Created by Carolina Bonnin. Activity referente a la seleccion de rutas.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `private class` | `PathGoogleMapActivity.connectAsyncTask` Tarea asincrona para no saturar el main thread
    `private class` | `PathGoogleMapActivity.Step` Clase step para los steps de la ruta

    - ### Nested classes/interfaces inherited from class android.app.Activity

      `android.app.Activity.TranslucentConversionListener`

    - ### Nested classes/interfaces inherited from class android.content.Context

      `android.content.Context.BindServiceFlags, android.content.Context.CreatePackageOptions, android.content.Context.ServiceName`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private int` | `clicked`
    `private int` | `cont`
    `(package private) android.content.Context` | `context`
    `private Controlador` | `controlador`
    `(package private) android.location.Location` | `currentLocation`
    `private java.lang.String` | `distanciaKm`
    `private android.location.Location` | `endLocation`
    `private com.google.android.gms.maps.GoogleMap` | `googleMap`
    `(package private) android.os.Handler` | `handler`
    `(package private) java.lang.String` | `lang`
    `(package private) static java.lang.String` | `LANGUAGE_ENGLISH`
    `private java.util.ArrayList<com.google.android.gms.maps.model.Marker>` | `markers`
    `private MensajeRuta` | `mensajeRuta`
    `private android.location.Location` | `myLocation`
    `private boolean` | `started`
    `private android.location.Location` | `startLocation`
    `private long` | `startWalking`
    `private long` | `stopWalking`
    `private java.util.Timer` | `timer`
    `private java.util.TimerTask` | `timerTask`
    `(package private) static java.lang.String` | `TRANSPORT_WALKING`

    - ### Fields inherited from class android.app.Activity

      `DEFAULT_KEYS_DIALER, DEFAULT_KEYS_DISABLE, DEFAULT_KEYS_SEARCH_GLOBAL, DEFAULT_KEYS_SEARCH_LOCAL, DEFAULT_KEYS_SHORTCUT, FOCUSED_STATE_SET, RESULT_CANCELED, RESULT_FIRST_USER, RESULT_OK`

    - ### Fields inherited from class android.content.Context

      `ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, APP_OPS_SERVICE, APPWIDGET_SERVICE, AUDIO_SERVICE, BACKUP_SERVICE, BATTERY_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_NOT_VISIBLE, BIND_SHOWING_UI, BIND_TREAT_LIKE_ACTIVITY, BIND_VISIBLE, BIND_WAIVE_PRIORITY, BLUETOOTH_SERVICE, CAMERA_SERVICE, CAPTIONING_SERVICE, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONSUMER_IR_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_REGISTER_PACKAGE, CONTEXT_RESTRICTED, COUNTRY_DETECTOR, DEVICE_POLICY_SERVICE, DISPLAY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, ETHERNET_SERVICE, FINGERPRINT_SERVICE, HDMI_CONTROL_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, JOB_SCHEDULER_SERVICE, KEYGUARD_SERVICE, LAUNCHER_APPS_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MEDIA_PROJECTION_SERVICE, MEDIA_ROUTER_SERVICE, MEDIA_SESSION_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_PRIVATE, NETWORK_POLICY_SERVICE, NETWORK_SCORE_SERVICE, NETWORK_STATS_SERVICE, NETWORKMANAGEMENT_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, PERSISTENT_DATA_BLOCK_SERVICE, POWER_SERVICE, PRINT_SERVICE, RESTRICTIONS_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, SERIAL_SERVICE, SIP_SERVICE, STATUS_BAR_SERVICE, STORAGE_SERVICE, TELECOM_SERVICE, TELEPHONY_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, TRUST_SERVICE, TV_INPUT_SERVICE, UI_MODE_SERVICE, UPDATE_LOCK_SERVICE, USAGE_STATS_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, VOICE_INTERACTION_MANAGER_SERVICE, WALLPAPER_SERVICE, WIFI_P2P_SERVICE, WIFI_PASSPOINT_SERVICE, WIFI_RTT_SERVICE, WIFI_SCANNING_SERVICE, WIFI_SERVICE, WINDOW_SERVICE`

    - ### Fields inherited from interface android.content.ComponentCallbacks2

      `TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PathGoogleMapActivity()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addCircleToMap(com.google.android.gms.maps.model.LatLng punto)` Metodo para insertar circulo en el mapa
    `private java.util.List<com.google.android.gms.maps.model.LatLng>` | `decodePoly(java.lang.String encoded)` Decodifica los puntos para dibujar la ruta
    `void` | `drawPath(java.lang.String result, boolean withSteps)` Metodo para dibujar la ruta
    `void` | `drawRoute(com.google.android.gms.maps.GoogleMap map, android.content.Context c, com.google.android.gms.maps.model.LatLng source, com.google.android.gms.maps.model.LatLng dest, java.lang.String mode, boolean withIndications, java.lang.String language)` Metodo para dibujar la ruta en el mapa
    `private void` | `enviarInformacionPuntos(java.util.List<com.google.android.gms.maps.model.LatLng> puntos)` Metodo para guardar la informacion de los puntos de la ruta para poder obtener, posteriormente, su imagen street view.
    `private void` | `generarDialogGuardarRuta(com.google.android.gms.maps.model.LatLng puntoInicio, com.google.android.gms.maps.model.LatLng puntoFinal)` Dialog para guardar la ruta
    `android.location.Location` | `getCurrentLocation()` Metodo para obtener la localizacion del usuario
    `void` | `initializeTimerTask()` Metodo que obtiene cada x tiempo la localizacion del usuario
    `private java.lang.String` | `makeURL(double sourcelat, double sourcelog, double destlat, double destlog, java.lang.String mode)` Genera la URL para dibujar la ruta
    `void` | `mostrarDialogLocalizacion()` Metodo que pide permisos para localizar al usuario
    `void` | `mostrarInformacionFinRuta()` Metodo para mostrar el dialog al finalizar la ruta
    `void` | `onBackPressed()` Take care of popping the fragment back stack or finishing the activity as appropriate.
    `protected void` | `onCreate(android.os.Bundle savedInstanceState)` Perform initialization of all fragments and loaders.
    `private void` | `setUpMapIfNeeded()` Metodo para configurar el mapa
    `void` | `startTimer()` Metodo para inicializar timer task
    `void` | `stopTimerTask()` Metodo para parar el timer

    - ### Methods inherited from class android.support.v4.app.FragmentActivity

      `dump, getLastCustomNonConfigurationInstance, getSupportFragmentManager, getSupportLoaderManager, onActivityResult, onAttachFragment, onConfigurationChanged, onCreatePanelMenu, onCreateView, onDestroy, onKeyDown, onLowMemory, onMenuItemSelected, onNewIntent, onPanelClosed, onPause, onPostResume, onPrepareOptionsPanel, onPreparePanel, onResume, onResumeFragments, onRetainCustomNonConfigurationInstance, onRetainNonConfigurationInstance, onSaveInstanceState, onStart, onStop, setEnterSharedElementCallback, setExitSharedElementCallback, startActivityForResult, startActivityFromFragment, supportFinishAfterTransition, supportInvalidateOptionsMenu, supportPostponeEnterTransition, supportStartPostponedEnterTransition`

    - ### Methods inherited from class android.app.Activity

      `addContentView, closeContextMenu, closeOptionsMenu, convertFromTranslucent, convertToTranslucent, createPendingResult, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, findViewById, finish, finishActivity, finishActivityFromChild, finishAffinity, finishAfterTransition, finishAndRemoveTask, finishFromChild, getActionBar, getActivityToken, getApplication, getCallingActivity, getCallingPackage, getChangingConfigurations, getComponentName, getContentScene, getContentTransitionManager, getCurrentFocus, getFragmentManager, getIntent, getLayoutInflater, getLoaderManager, getLocalClassName, getMediaController, getMenuInflater, getParent, getParentActivityIntent, getPreferences, getRequestedOrientation, getSystemService, getTaskId, getTitle, getTitleColor, getVoiceInteractor, getVolumeControlStream, getWindow, getWindowManager, hasWindowFocus, invalidateOptionsMenu, isBackgroundVisibleBehind, isChangingConfigurations, isChild, isDestroyed, isFinishing, isImmersive, isResumed, isTaskRoot, isVoiceInteraction, moveTaskToBack, navigateUpTo, navigateUpToFromChild, onActionModeFinished, onActionModeStarted, onActivityReenter, onApplyThemeResource, onAttachedToWindow, onAttachFragment, onBackgroundVisibleBehindChanged, onChildTitleChanged, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreate, onCreateContextMenu, onCreateDescription, onCreateNavigateUpTaskStack, onCreateOptionsMenu, onCreatePanelView, onCreateThumbnail, onCreateView, onDetachedFromWindow, onEnterAnimationComplete, onGenericMotionEvent, onKeyLongPress, onKeyMultiple, onKeyShortcut, onKeyUp, onMenuOpened, onNavigateUp, onNavigateUpFromChild, onNewActivityOptions, onOptionsItemSelected, onOptionsMenuClosed, onPostCreate, onPostCreate, onPrepareNavigateUpTaskStack, onPrepareOptionsMenu, onProvideAssistData, onRestart, onRestoreInstanceState, onRestoreInstanceState, onSaveInstanceState, onSearchRequested, onTitleChanged, onTouchEvent, onTrackballEvent, onTrimMemory, onUserInteraction, onUserLeaveHint, onVisibleBehindCanceled, onWindowAttributesChanged, onWindowDismissed, onWindowFocusChanged, onWindowStartingActionMode, openContextMenu, openOptionsMenu, overridePendingTransition, postponeEnterTransition, recreate, registerForContextMenu, releaseInstance, reportFullyDrawn, requestVisibleBehind, requestWindowFeature, runOnUiThread, setActionBar, setContentTransitionManager, setContentView, setContentView, setContentView, setDefaultKeyMode, setEnterSharedElementCallback, setExitSharedElementCallback, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setFinishOnTouchOutside, setImmersive, setIntent, setMediaController, setProgress, setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setRequestedOrientation, setResult, setResult, setSecondaryProgress, setTaskDescription, setTitle, setTitle, setVisible, setVolumeControlStream, shouldUpRecreateTask, startActionMode, startActivities, startActivities, startActivity, startActivity, startActivityAsCaller, startActivityAsUser, startActivityAsUser, startActivityForResult, startActivityForResultAsUser, startActivityForResultAsUser, startActivityFromChild, startActivityFromChild, startActivityFromFragment, startActivityFromFragment, startActivityIfNeeded, startActivityIfNeeded, startIntentSender, startIntentSender, startIntentSenderForResult, startIntentSenderForResult, startIntentSenderFromChild, startIntentSenderFromChild, startLockTask, startNextMatchingActivity, startNextMatchingActivity, startPostponedEnterTransition, startSearch, stopLockTask, takeKeyEvents, triggerSearch, unregisterForContextMenu`

    - ### Methods inherited from class android.view.ContextThemeWrapper

      `applyOverrideConfiguration, attachBaseContext, getResources, getTheme, getThemeResId, setTheme`

    - ### Methods inherited from class android.content.ContextWrapper

      `bindService, bindServiceAsUser, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkUriPermission, checkUriPermission, clearWallpaper, createApplicationContext, createConfigurationContext, createDisplayContext, createPackageContext, createPackageContextAsUser, databaseList, deleteDatabase, deleteFile, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getBaseContext, getBasePackageName, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDatabasePath, getDir, getDisplayAdjustments, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFilesDir, getFileStreamPath, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getOpPackageName, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getSharedPreferences, getSharedPrefsFile, getUserId, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isRestricted, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, registerReceiverAsUser, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setWallpaper, setWallpaper, startActivitiesAsUser, startInstrumentation, startService, startServiceAsUser, stopService, stopServiceAsUser, unbindService, unregisterReceiver`

    - ### Methods inherited from class android.content.Context

      `getDrawable, getString, getString, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, registerComponentCallbacks, unregisterComponentCallbacks`

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

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

- - ### Field Detail

    - #### clicked

          private int clicked

    - #### cont

          private int cont

    - #### context

          android.content.Context context

    - #### controlador

          private Controlador controlador

    - #### currentLocation

          android.location.Location currentLocation

    - #### distanciaKm

          private java.lang.String distanciaKm

    - #### endLocation

          private android.location.Location endLocation

    - #### googleMap

          private com.google.android.gms.maps.GoogleMap googleMap

    - #### handler

          final android.os.Handler handler

    - #### lang

          java.lang.String lang

    - #### LANGUAGE_ENGLISH

          static java.lang.String LANGUAGE_ENGLISH

    - #### markers

          private java.util.ArrayList<com.google.android.gms.maps.model.Marker> markers

    - #### mensajeRuta

          private MensajeRuta mensajeRuta

    - #### myLocation

          private android.location.Location myLocation

    - #### started

          private boolean started

    - #### startLocation

          private android.location.Location startLocation

    - #### startWalking

          private long startWalking

    - #### stopWalking

          private long stopWalking

    - #### timer

          private java.util.Timer timer

    - #### timerTask

          private java.util.TimerTask timerTask

    - #### TRANSPORT_WALKING

          static java.lang.String TRANSPORT_WALKING

  - ### Constructor Detail

    - #### PathGoogleMapActivity

          public PathGoogleMapActivity()

  - ### Method Detail

    - #### addCircleToMap

          public void addCircleToMap(com.google.android.gms.maps.model.LatLng punto)

      Metodo para insertar circulo en el mapa
      Parameters:
        `punto` - en el que queremos poner el circulo

    - #### decodePoly

          private java.util.List<com.google.android.gms.maps.model.LatLng> decodePoly(java.lang.String encoded)

      Decodifica los puntos para dibujar la ruta
      Parameters:
        `encoded` - string codificada
      Returns:
        listado con los puntos decodificados

    - #### drawPath

          public void drawPath(java.lang.String result,
                               boolean withSteps)

      Metodo para dibujar la ruta
      Parameters:
        `result` - url decodificada
        `withSteps` - si hay o no steps

    - #### drawRoute

          public void drawRoute(com.google.android.gms.maps.GoogleMap map,
                                android.content.Context c,
                                com.google.android.gms.maps.model.LatLng source,
                                com.google.android.gms.maps.model.LatLng dest,
                                java.lang.String mode,
                                boolean withIndications,
                                java.lang.String language)

      Metodo para dibujar la ruta en el mapa
      Parameters:
        `map` - sobre el que dibujamos la ruta
        `c` - context
        `source` - punto de inicio
        `dest` - punto de destino
        `mode` - walking
        `withIndications` - si hay o no indicaciones durante el camino
        `language` - idioma

    - #### enviarInformacionPuntos

          private void enviarInformacionPuntos(java.util.List<com.google.android.gms.maps.model.LatLng> puntos)

      Metodo para guardar la informacion de los puntos de la ruta para poder obtener, posteriormente, su imagen street view.

    - #### generarDialogGuardarRuta

          private void generarDialogGuardarRuta(com.google.android.gms.maps.model.LatLng puntoInicio,
                                                com.google.android.gms.maps.model.LatLng puntoFinal)

      Dialog para guardar la ruta
      Parameters:
        `puntoInicio` - punto de inicio de la ruta
        `puntoFinal` - punto de finalizacion de la ruta

    - #### getCurrentLocation

          public android.location.Location getCurrentLocation()

      Metodo para obtener la localizacion del usuario
      Returns:
        localizacion dle usuario

    - #### initializeTimerTask

          public void initializeTimerTask()

      Metodo que obtiene cada x tiempo la localizacion del usuario

    - #### makeURL

          private java.lang.String makeURL(double sourcelat,
                                           double sourcelog,
                                           double destlat,
                                           double destlog,
                                           java.lang.String mode)

      Genera la URL para dibujar la ruta
      Parameters:
        `sourcelat` - punto de inicio latitud
        `sourcelog` - punto de inicio longitud
        `destlat` - punto de destino latitud
        `destlog` - punto de destino longitud
        `mode` - walking
      Returns:
        url

    - #### mostrarDialogLocalizacion

          public void mostrarDialogLocalizacion()

      Metodo que pide permisos para localizar al usuario

    - #### mostrarInformacionFinRuta

          public void mostrarInformacionFinRuta()

      Metodo para mostrar el dialog al finalizar la ruta

    - #### onBackPressed

          public void onBackPressed()

      Description copied from class: `android.support.v4.app.FragmentActivity`
      Take care of popping the fragment back stack or finishing the activity as appropriate.
      Overrides:
        `onBackPressed` in class `android.support.v4.app.FragmentActivity`

    - #### onCreate

          protected void onCreate(android.os.Bundle savedInstanceState)

      Description copied from class: `android.support.v4.app.FragmentActivity`
      Perform initialization of all fragments and loaders.
      Overrides:
        `onCreate` in class `android.support.v4.app.FragmentActivity`
      Parameters:
        `savedInstanceState` - If the activity is being re-initialized after previously being shut down then this Bundle contains the data it most recently supplied in `Activity.onSaveInstanceState(android.os.Bundle)`. Note: Otherwise it is null.
      See Also:
        `Activity.onStart()`, `Activity.onSaveInstanceState(android.os.Bundle)`, `Activity.onRestoreInstanceState(android.os.Bundle)`, `Activity.onPostCreate(android.os.Bundle)`

    - #### setUpMapIfNeeded

          private void setUpMapIfNeeded()

      Metodo para configurar el mapa

    - #### startTimer

          public void startTimer()

      Metodo para inicializar timer task

    - #### stopTimerTask

          public void stopTimerTask()

      Metodo para parar el timer