aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2011-09-16 14:36:28 +0200
committerSamuel Tardieu <sam@rfc1149.net>2011-09-16 14:36:28 +0200
commit579ef7a535489d4aa632db11667a3b01deb6cafd (patch)
tree55810021c02ac7d80d3a9702ef0b59e4af154b9c /main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java
parent96ea21fd50334479c262da692038965d0e4d596a (diff)
downloadcgeo-579ef7a535489d4aa632db11667a3b01deb6cafd.zip
cgeo-579ef7a535489d4aa632db11667a3b01deb6cafd.tar.gz
cgeo-579ef7a535489d4aa632db11667a3b01deb6cafd.tar.bz2
Move sources into the main directory
This prepares the inclusion of tests into the same repository.
Diffstat (limited to 'main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java')
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java68
1 files changed, 68 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java
new file mode 100644
index 0000000..2d27493
--- /dev/null
+++ b/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java
@@ -0,0 +1,68 @@
+package cgeo.geocaching.apps.cache.navi;
+
+import cgeo.geocaching.R;
+import cgeo.geocaching.cgCache;
+import cgeo.geocaching.cgGeo;
+import cgeo.geocaching.cgWaypoint;
+import cgeo.geocaching.geopoint.Geopoint;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.res.Resources;
+
+import java.util.ArrayList;
+import java.util.Locale;
+import java.util.UUID;
+
+class RMapsApp extends AbstractNavigationApp implements NavigationApp {
+
+ private static final String INTENT = "com.robert.maps.action.SHOW_POINTS";
+
+ RMapsApp(final Resources res) {
+ super(res.getString(R.string.cache_menu_rmaps), INTENT);
+ }
+
+ @Override
+ public boolean invoke(cgGeo geo, Activity activity, Resources res,
+ cgCache cache,
+ final UUID searchId, cgWaypoint waypoint, final Geopoint coords) {
+ if (cache == null && waypoint == null && coords == null) {
+ return false;
+ }
+
+ try {
+ if (isInstalled(activity)) {
+ final ArrayList<String> locations = new ArrayList<String>();
+ if (cache != null && cache.coords != null) {
+ locations.add(String.format((Locale) null, "%.6f",
+ cache.coords.getLatitude())
+ + ","
+ + String.format((Locale) null, "%.6f",
+ cache.coords.getLongitude())
+ + ";"
+ + cache.geocode
+ + ";" + cache.name);
+ } else if (waypoint != null && waypoint.coords != null) {
+ locations.add(String.format((Locale) null, "%.6f",
+ waypoint.coords.getLatitude())
+ + ","
+ + String.format((Locale) null, "%.6f",
+ waypoint.coords.getLongitude())
+ + ";"
+ + waypoint.lookup
+ + ";" + waypoint.name);
+ }
+
+ final Intent intent = new Intent(INTENT);
+ intent.putStringArrayListExtra("locations", locations);
+ activity.startActivity(intent);
+
+ return true;
+ }
+ } catch (Exception e) {
+ // nothing
+ }
+
+ return false;
+ }
+}