diff options
Diffstat (limited to 'main/src/cgeo/geocaching/apps/cache/navi/GoogleMapsDirectionApp.java')
-rw-r--r-- | main/src/cgeo/geocaching/apps/cache/navi/GoogleMapsDirectionApp.java | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/GoogleMapsDirectionApp.java b/main/src/cgeo/geocaching/apps/cache/navi/GoogleMapsDirectionApp.java index 4924786..d14fca4 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/GoogleMapsDirectionApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/GoogleMapsDirectionApp.java @@ -1,17 +1,17 @@ package cgeo.geocaching.apps.cache.navi; -import cgeo.geocaching.CgeoApplication; -import cgeo.geocaching.sensors.IGeoData; import cgeo.geocaching.R; -import cgeo.geocaching.geopoint.Geopoint; +import cgeo.geocaching.location.Geopoint; import cgeo.geocaching.maps.MapProviderFactory; +import cgeo.geocaching.sensors.GeoData; +import cgeo.geocaching.sensors.Sensors; import cgeo.geocaching.utils.Log; import android.app.Activity; import android.content.Intent; import android.net.Uri; -public class GoogleMapsDirectionApp extends AbstractPointNavigationApp { +class GoogleMapsDirectionApp extends AbstractPointNavigationApp { protected GoogleMapsDirectionApp() { super(getString(R.string.cache_menu_maps_directions), R.id.cache_app_google_maps_direction, null); @@ -23,23 +23,15 @@ public class GoogleMapsDirectionApp extends AbstractPointNavigationApp { } @Override - public void navigate(Activity activity, Geopoint coords) { + public void navigate(final Activity activity, final Geopoint coords) { try { - IGeoData geo = CgeoApplication.getInstance().currentGeo(); - final Geopoint coordsNow = geo == null ? null : geo.getCoords(); - - if (coordsNow != null) { - activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri - .parse("http://maps.google.com/maps?f=d&saddr=" - + coordsNow.getLatitude() + "," + coordsNow.getLongitude() + "&daddr=" - + coords.getLatitude() + "," + coords.getLongitude()))); - } else { - activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri - .parse("http://maps.google.com/maps?f=d&daddr=" - + coords.getLatitude() + "," + coords.getLongitude()))); - } - - } catch (Exception e) { + final GeoData geo = Sensors.getInstance().currentGeo(); + activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri + .parse("http://maps.google.com/maps?f=d&saddr=" + + geo.getCoords().getLatitude() + "," + geo.getCoords().getLongitude() + "&daddr=" + + coords.getLatitude() + "," + coords.getLongitude()))); + + } catch (final Exception e) { Log.i("GoogleMapsDirectionApp: application not available.", e); } |