aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
authorMichael Keppler <bananeweizen@gmx.de>2013-12-25 19:13:29 +0100
committerMichael Keppler <bananeweizen@gmx.de>2013-12-25 19:13:29 +0100
commit8ad11e0e6631001e1566e39a825df09476b8108c (patch)
tree029c5f2ef945f9cd1a716681f38f180f37b8a1e7 /main/src
parent70b46351fe51e68df1efbf2f089b02fc49cd2dbb (diff)
downloadcgeo-8ad11e0e6631001e1566e39a825df09476b8108c.zip
cgeo-8ad11e0e6631001e1566e39a825df09476b8108c.tar.gz
cgeo-8ad11e0e6631001e1566e39a825df09476b8108c.tar.bz2
fix #3481: new navigation menu for Pebble application
Diffstat (limited to 'main/src')
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java3
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/PebbleApp.java44
2 files changed, 46 insertions, 1 deletions
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
index aae3c43..bf0e776 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
@@ -71,7 +71,8 @@ public final class NavigationAppFactory extends AbstractAppFactory {
CACHE_BEACON(new CacheBeaconApp(), 14, R.string.pref_navigation_menu_cache_beacon),
GCC(new GccApp(), 15, R.string.pref_navigation_menu_gcc),
- WHERE_YOU_GO(new WhereYouGoApp(), 16, R.string.pref_navigation_menu_where_you_go);
+ WHERE_YOU_GO(new WhereYouGoApp(), 16, R.string.pref_navigation_menu_where_you_go),
+ PEBBLE(new PebbleApp(), 17, R.string.pref_navigation_menu_pebble);
NavigationAppsEnum(final App app, final int id, final int preferenceKey) {
this.app = app;
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/PebbleApp.java b/main/src/cgeo/geocaching/apps/cache/navi/PebbleApp.java
new file mode 100644
index 0000000..8ba3bef
--- /dev/null
+++ b/main/src/cgeo/geocaching/apps/cache/navi/PebbleApp.java
@@ -0,0 +1,44 @@
+package cgeo.geocaching.apps.cache.navi;
+
+import cgeo.geocaching.Geocache;
+import cgeo.geocaching.R;
+import cgeo.geocaching.geopoint.Geopoint;
+
+import android.app.Activity;
+import android.content.Intent;
+
+/**
+ * Application for communication with the Pebble watch.
+ *
+ */
+class PebbleApp extends AbstractPointNavigationApp {
+
+ private static final String INTENT = "com.webmajstr.pebble_gc.NAVIGATE_TO";
+ private static final String PACKAGE_NAME = "com.webmajstr.pebble_gc";
+
+ PebbleApp() {
+ super(getString(R.string.cache_menu_pebble), R.id.cache_app_pebble, INTENT, PACKAGE_NAME);
+ }
+
+ @Override
+ public void navigate(Activity activity, Geopoint point) {
+ final Intent pebbleIntent = new Intent(INTENT);
+ pebbleIntent.putExtra("latitude", point.getLatitude());
+ pebbleIntent.putExtra("longitude", point.getLongitude());
+ activity.startActivity(pebbleIntent);
+ }
+
+ @Override
+ public void navigate(Activity activity, Geocache cache) {
+ 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());
+ activity.startActivity(pebbleIntent);
+ }
+
+} \ No newline at end of file