diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/res/values-de/strings.xml | 2 | ||||
-rw-r--r-- | main/res/values/strings.xml | 3 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/cgeowaypoint.java | 18 |
3 files changed, 23 insertions, 0 deletions
diff --git a/main/res/values-de/strings.xml b/main/res/values-de/strings.xml index 57059c3..c48f397 100644 --- a/main/res/values-de/strings.xml +++ b/main/res/values-de/strings.xml @@ -176,6 +176,7 @@ <string name="err_waypoint_add_failed">c:geo konnte den Wegpunkt nicht hinzufügen.</string> <string name="err_waypoint_load_failed">c:geo konnte den Wegpunkt nicht laden.</string> <string name="err_waypoint_delete_failed">c:geo konnte den Wegpunkt nicht löschen.</string> + <string name="err_waypoint_open_cache_failed">c:geo konnte die Cachedetails nicht laden.</string> <string name="err_point_unknown_position">c:geo konnte deinen Standort nicht bestimmen.</string> <string name="err_point_no_position_given_title">Info benötigt</string> <string name="err_point_no_position_given">Mindestens Längen- und Breitengrad oder Entfernung und Richtung angeben. Auch alle Angaben sind möglich.</string> @@ -617,6 +618,7 @@ <string name="waypoint_done">Fertig</string> <string name="waypoint_duplicate">Duplizieren</string> <string name="waypoint_copy_of">Kopie von</string> + <string name="waypoint_menu_open_cache">Cache öffnen</string> <string name="search_history">Verlauf</string> <string name="search_history_empty">Keine Ziele bisher</string> <string name="search_remove_destination">Ziel gelöscht</string> diff --git a/main/res/values/strings.xml b/main/res/values/strings.xml index 7e89f74..9611212 100644 --- a/main/res/values/strings.xml +++ b/main/res/values/strings.xml @@ -176,6 +176,7 @@ <string name="err_waypoint_add_failed">Sorry, c:geo failed to add your waypoint.</string> <string name="err_waypoint_load_failed">Sorry, c:geo failed to load waypoint.</string> <string name="err_waypoint_delete_failed">Sorry, c:geo can\'t delete waypoint.</string> + <string name="err_waypoint_open_cache_failed">Sorry, c:geo can\'t open cache details.</string> <string name="err_point_unknown_position">Sorry, c:geo can\'t recognize where you are.</string> <string name="err_point_no_position_given_title">Info required</string> <string name="err_point_no_position_given">Fill at least latitude or longitude or distance and bearing. You can also fill all four fields.</string> @@ -632,6 +633,7 @@ <string name="waypoint_done">Done</string> <string name="waypoint_duplicate">Duplicate</string> <string name="waypoint_copy_of">Copy of</string> + <string name="waypoint_menu_open_cache">Open Cache</string> <string name="search_history">History</string> <string name="search_history_empty">No previous destinations</string> <string name="search_remove_destination">Destination removed</string> @@ -944,6 +946,7 @@ · Rainer S. (code)\n · Ray (code, loc. JA)\n · <a href="http://seromenho.com/">Ricardo Seromenho</a> (localization PT)\n + · RoadRunner- (code, loc. DE)\n · <a href="http://www.blueskysoftware.it/">RomNexus6</a> (localization IT)\n · <a href="http://www.sammyshp.de/">SammysHP</a> (code, localization DE)\n · <a href="http://www.rfc1149.net/sam.html">Samuel Tardieu</a> (code, localization FR)\n diff --git a/main/src/cgeo/geocaching/cgeowaypoint.java b/main/src/cgeo/geocaching/cgeowaypoint.java index 218c61b..3d35189 100644 --- a/main/src/cgeo/geocaching/cgeowaypoint.java +++ b/main/src/cgeo/geocaching/cgeowaypoint.java @@ -27,6 +27,7 @@ public class cgeowaypoint extends AbstractActivity { private static final int MENU_ID_NAVIGATION = 0; private static final int MENU_ID_CACHES_AROUND = 5; private static final int MENU_ID_DEFAULT_NAVIGATION = 2; + private static final int MENU_ID_OPEN_GEOCACHE = 6; private cgWaypoint waypoint = null; private String geocode = null; private int id = -1; @@ -214,6 +215,7 @@ public class cgeowaypoint extends AbstractActivity { addNavigationMenuItems(subMenu); menu.add(0, MENU_ID_CACHES_AROUND, 0, res.getString(R.string.cache_menu_around)).setIcon(android.R.drawable.ic_menu_rotate); // caches around + menu.add(0, MENU_ID_OPEN_GEOCACHE, 0, res.getString(R.string.waypoint_menu_open_cache)).setIcon(android.R.drawable.ic_menu_mylocation); // open geocache return true; } @@ -231,6 +233,9 @@ public class cgeowaypoint extends AbstractActivity { menu.findItem(MENU_ID_NAVIGATION).setVisible(visible); menu.findItem(MENU_ID_DEFAULT_NAVIGATION).setVisible(visible); menu.findItem(MENU_ID_CACHES_AROUND).setVisible(visible); + + boolean openGeocache = StringUtils.isEmpty(geocode) && StringUtils.isNotEmpty(waypoint.getGeocode()); + menu.findItem(MENU_ID_OPEN_GEOCACHE).setVisible(openGeocache); } catch (Exception e) { // nothing } @@ -247,6 +252,9 @@ public class cgeowaypoint extends AbstractActivity { } else if (menuItem == MENU_ID_CACHES_AROUND) { cachesAround(); return true; + } else if (menuItem == MENU_ID_OPEN_GEOCACHE) { + goToGeocache(); + return true; } return NavigationAppFactory.onMenuItemSelected(item, geo, this, null, null, waypoint, null); @@ -262,6 +270,16 @@ public class cgeowaypoint extends AbstractActivity { finish(); } + private void goToGeocache() { + if (waypoint == null || waypoint.getGeocode() == null) { + showToast(res.getString(R.string.err_waypoint_open_cache_failed)); + } + + CacheDetailActivity.startActivity(this, waypoint.getGeocode()); + + finish(); + } + private class loadWaypoint extends Thread { @Override |