aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/apps
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2014-01-25 06:36:18 +0100
committerBananeweizen <bananeweizen@gmx.de>2014-01-25 06:36:18 +0100
commitc29b05588c0fe6676905b5ed4b15cb0969066b3a (patch)
treea3f7c09c045964b387aa945db9edc4a5765d153c /main/src/cgeo/geocaching/apps
parentbf9ca3ff2aed598a8e4adc45a9380e6e83891e24 (diff)
downloadcgeo-c29b05588c0fe6676905b5ed4b15cb0969066b3a.zip
cgeo-c29b05588c0fe6676905b5ed4b15cb0969066b3a.tar.gz
cgeo-c29b05588c0fe6676905b5ed4b15cb0969066b3a.tar.bz2
fix #3567: More extras to intent
Diffstat (limited to 'main/src/cgeo/geocaching/apps')
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java9
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/PebbleApp.java8
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/RadarApp.java15
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