aboutsummaryrefslogtreecommitdiffstats
path: root/src/cgeo/geocaching/apps/cache/navi/StreetviewApp.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgeo/geocaching/apps/cache/navi/StreetviewApp.java')
-rw-r--r--src/cgeo/geocaching/apps/cache/navi/StreetviewApp.java18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/cgeo/geocaching/apps/cache/navi/StreetviewApp.java b/src/cgeo/geocaching/apps/cache/navi/StreetviewApp.java
index 250bc65..1b8a101 100644
--- a/src/cgeo/geocaching/apps/cache/navi/StreetviewApp.java
+++ b/src/cgeo/geocaching/apps/cache/navi/StreetviewApp.java
@@ -13,6 +13,7 @@ import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgGeo;
import cgeo.geocaching.cgWaypoint;
import cgeo.geocaching.activity.ActivityMixin;
+import cgeo.geocaching.geopoint.Geopoint;
class StreetviewApp extends AbstractNavigationApp implements NavigationApp {
@@ -27,16 +28,16 @@ class StreetviewApp extends AbstractNavigationApp implements NavigationApp {
public boolean invoke(cgGeo geo, Activity activity, Resources res,
cgCache cache,
- final UUID searchId, cgWaypoint waypoint, Double latitude, Double longitude) {
- if (cache == null && waypoint == null && latitude == null && longitude == null) {
+ final UUID searchId, cgWaypoint waypoint, final Geopoint coords) {
+ if (cache == null && waypoint == null && coords == null) {
return false;
}
try {
- if (cache != null && cache.latitude != null && cache.longitude != null) {
- activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("google.streetview:cbll=" + cache.latitude + "," + cache.longitude)));
- } else if (waypoint != null && waypoint.latitude != null && waypoint.longitude != null) {
- activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("google.streetview:cbll=" + waypoint.latitude + "," + waypoint.longitude)));
+ if (cache != null && cache.coords != null) {
+ startActivity(activity, cache.coords);
+ } else if (waypoint != null && waypoint.coords != null) {
+ startActivity(activity, waypoint.coords);
}
return true;
@@ -48,4 +49,9 @@ class StreetviewApp extends AbstractNavigationApp implements NavigationApp {
return false;
}
+
+ private void startActivity(Activity activity, final Geopoint coords) {
+ activity.startActivity(new Intent(Intent.ACTION_VIEW,
+ Uri.parse("google.streetview:cbll=" + coords.getLatitude() + "," + coords.getLongitude())));
+ }
}