diff options
Diffstat (limited to 'main/src/cgeo/geocaching/apps/cache')
-rw-r--r-- | main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java b/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java index 6a29895..0bf2f56 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java @@ -2,10 +2,10 @@ package cgeo.geocaching.apps.cache.navi; import cgeo.geocaching.R; import cgeo.geocaching.SearchResult; +import cgeo.geocaching.StaticMapsActivity; import cgeo.geocaching.cgCache; import cgeo.geocaching.cgGeo; import cgeo.geocaching.cgWaypoint; -import cgeo.geocaching.StaticMapsActivity; import cgeo.geocaching.activity.ActivityMixin; import cgeo.geocaching.geopoint.Geopoint; @@ -28,18 +28,24 @@ class StaticMapApp extends AbstractNavigationApp { public boolean invoke(cgGeo geo, Activity activity, cgCache cache, final SearchResult search, cgWaypoint waypoint, final Geopoint coords) { - if (cache == null || cache.getListId() == 0) { + String geocode = null; + if (cache != null && cache.getListId() != 0) { + geocode = cache.getGeocode().toUpperCase(); + } + if (waypoint != null) { + geocode = waypoint.getGeocode().toUpperCase(); + } + if (geocode == null) { ActivityMixin.showToast(activity, getString(R.string.err_detail_no_map_static)); return true; - } - - if (cache.getGeocode() != null) { + } else { final Intent intent = new Intent(activity, StaticMapsActivity.class); - intent.putExtra("geocode", cache.getGeocode().toUpperCase()); + intent.putExtra("geocode", geocode); + if (waypoint != null) { + intent.putExtra("waypoint", waypoint.getId()); + } activity.startActivity(intent); return true; } - return false; } - } |