diff options
-rw-r--r-- | main/res/layout/coords.xml | 5 | ||||
-rw-r--r-- | main/res/values-de/strings.xml | 1 | ||||
-rw-r--r-- | main/res/values/strings.xml | 1 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/cgeocoords.java | 20 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/cgeowaypointadd.java | 3 |
5 files changed, 28 insertions, 2 deletions
diff --git a/main/res/layout/coords.xml b/main/res/layout/coords.xml index fdf7f49..a0c65d8 100644 --- a/main/res/layout/coords.xml +++ b/main/res/layout/coords.xml @@ -106,6 +106,11 @@ <Button style="@style/button" android:layout_width="fill_parent" android:layout_height="wrap_content" + android:id="@+id/cache" + android:text="@string/waypoint_cache_coordinates" /> + <Button style="@style/button" + android:layout_width="fill_parent" + android:layout_height="wrap_content" android:id="@+id/done" android:text="@string/waypoint_done" /> </LinearLayout> diff --git a/main/res/values-de/strings.xml b/main/res/values-de/strings.xml index 79a94bc..7b5e516 100644 --- a/main/res/values-de/strings.xml +++ b/main/res/values-de/strings.xml @@ -603,6 +603,7 @@ <!-- waypoint --> <string name="waypoint">Wegpunkt</string> <string name="waypoint_title">Wegpunkt</string> + <string name="waypoint_cache_coordinates">Cache Koordinaten</string> <string name="waypoint_custom">Benutzerdefiniert</string> <string name="waypoint_my_coordinates">Meine Koordinaten</string> <string name="waypoint_bearing">Richtung</string> diff --git a/main/res/values/strings.xml b/main/res/values/strings.xml index 888374e..89418c7 100644 --- a/main/res/values/strings.xml +++ b/main/res/values/strings.xml @@ -617,6 +617,7 @@ <!-- waypoint --> <string name="waypoint">Waypoint</string> <string name="waypoint_title">Waypoint</string> + <string name="waypoint_cache_coordinates">Cache coordinates</string> <string name="waypoint_custom">Custom</string> <string name="waypoint_my_coordinates">My coordinates</string> <string name="waypoint_bearing">Bearing</string> diff --git a/main/src/cgeo/geocaching/cgeocoords.java b/main/src/cgeo/geocaching/cgeocoords.java index 367fb22..452d5fb 100644 --- a/main/src/cgeo/geocaching/cgeocoords.java +++ b/main/src/cgeo/geocaching/cgeocoords.java @@ -29,6 +29,7 @@ public class cgeocoords extends Dialog { final private AbstractActivity context; final private cgGeo geo; + final private cgCache cache; private Geopoint gp; private EditText eLat, eLon; @@ -44,10 +45,11 @@ public class cgeocoords extends Dialog { private coordInputFormatEnum currentFormat = null; - public cgeocoords(final AbstractActivity context, final Geopoint gp, final cgGeo geo) { + public cgeocoords(final AbstractActivity context, final cgCache cache, final Geopoint gp, final cgGeo geo) { super(context); this.context = context; this.geo = geo; + this.cache = cache; if (gp != null) { this.gp = gp; @@ -131,6 +133,8 @@ public class cgeocoords extends Dialog { final Button buttonCurrent = (Button) findViewById(R.id.current); buttonCurrent.setOnClickListener(new CurrentListener()); + final Button buttonCache = (Button) findViewById(R.id.cache); + buttonCache.setOnClickListener(new CacheListener()); final Button buttonDone = (Button) findViewById(R.id.done); buttonDone.setOnClickListener(new InputDoneListener()); } @@ -481,6 +485,20 @@ public class cgeocoords extends Dialog { } } + private class CacheListener implements View.OnClickListener { + + @Override + public void onClick(View v) { + if (cache == null || cache.getCoords() == null) { + context.showToast(context.getResources().getString(R.string.err_location_unknown)); + return; + } + + gp = cache.getCoords(); + updateGUI(); + } + } + private class InputDoneListener implements View.OnClickListener { @Override diff --git a/main/src/cgeo/geocaching/cgeowaypointadd.java b/main/src/cgeo/geocaching/cgeowaypointadd.java index 74aee55..66e000e 100644 --- a/main/src/cgeo/geocaching/cgeowaypointadd.java +++ b/main/src/cgeo/geocaching/cgeowaypointadd.java @@ -229,7 +229,8 @@ public class cgeowaypointadd extends AbstractActivity { if (waypoint != null && waypoint.getCoords() != null) { gp = waypoint.getCoords(); } - cgeocoords coordsDialog = new cgeocoords(cgeowaypointadd.this, gp, geo); + cgCache cache = app.getCacheByGeocode(geocode); + cgeocoords coordsDialog = new cgeocoords(cgeowaypointadd.this, cache, gp, geo); coordsDialog.setCancelable(true); coordsDialog.setOnCoordinateUpdate(new cgeocoords.CoordinateUpdate() { @Override |