diff options
3 files changed, 25 insertions, 7 deletions
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java b/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java index a1c752c..7cc5a4f 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java @@ -8,6 +8,7 @@ import cgeo.geocaching.apps.AbstractApp; import cgeo.geocaching.geopoint.Geopoint; import android.app.Activity; +import android.content.Intent; /** * navigation app for simple point navigation (no differentiation between cache/waypoint/point) @@ -49,4 +50,12 @@ abstract class AbstractPointNavigationApp extends AbstractApp implements CacheNa public boolean isEnabled(Waypoint waypoint) { return waypoint.getCoords() != null; } + + protected static void addIntentExtras(final Geocache cache, final Intent intent) { + intent.putExtra("difficulty", cache.getDifficulty()); + intent.putExtra("terrain", cache.getTerrain()); + intent.putExtra("name", cache.getName()); + intent.putExtra("code", cache.getGeocode()); + intent.putExtra("size", cache.getSize().getL10n()); + } } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/PebbleApp.java b/main/src/cgeo/geocaching/apps/cache/navi/PebbleApp.java index 8ba3bef..9fe2fc1 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/PebbleApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/PebbleApp.java @@ -9,7 +9,7 @@ import android.content.Intent; /**
* Application for communication with the Pebble watch.
- *
+ *
*/
class PebbleApp extends AbstractPointNavigationApp {
@@ -33,11 +33,7 @@ class PebbleApp extends AbstractPointNavigationApp { final Intent pebbleIntent = new Intent(INTENT);
pebbleIntent.putExtra("latitude", cache.getCoords().getLatitude());
pebbleIntent.putExtra("longitude", cache.getCoords().getLongitude());
- pebbleIntent.putExtra("difficulty", cache.getDifficulty());
- pebbleIntent.putExtra("terrain", cache.getTerrain());
- pebbleIntent.putExtra("name", cache.getName());
- pebbleIntent.putExtra("code", cache.getGeocode());
- pebbleIntent.putExtra("size", cache.getSize().getL10n());
+ addIntentExtras(cache, pebbleIntent);
activity.startActivity(pebbleIntent);
}
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/RadarApp.java b/main/src/cgeo/geocaching/apps/cache/navi/RadarApp.java index ffa6650..23e696b 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/RadarApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/RadarApp.java @@ -1,5 +1,6 @@ package cgeo.geocaching.apps.cache.navi; +import cgeo.geocaching.Geocache; import cgeo.geocaching.R; import cgeo.geocaching.geopoint.Geopoint; @@ -16,10 +17,22 @@ class RadarApp extends AbstractPointNavigationApp { } @Override - public void navigate(Activity activity, Geopoint point) { + public void navigate(final Activity activity, final Geopoint point) { + final Intent radarIntent = createRadarIntent(point); + activity.startActivity(radarIntent); + } + + private static Intent createRadarIntent(final Geopoint point) { final Intent radarIntent = new Intent(INTENT); radarIntent.putExtra("latitude", (float) point.getLatitude()); radarIntent.putExtra("longitude", (float) point.getLongitude()); + return radarIntent; + } + + @Override + public void navigate(final Activity activity, final Geocache cache) { + final Intent radarIntent = createRadarIntent(cache.getCoords()); + addIntentExtras(cache, radarIntent); activity.startActivity(radarIntent); } }
\ No newline at end of file |
