diff options
| author | rsudev <rasch@munin-soft.de> | 2012-02-01 13:16:43 -0800 |
|---|---|---|
| committer | rsudev <rasch@munin-soft.de> | 2012-02-01 13:16:43 -0800 |
| commit | 1c728393b8a9024de872c715da8b211e2da8010e (patch) | |
| tree | 0e67ac6f79a0be5583e473d17c089b7a021c1e3a /main/src/cgeo | |
| parent | 7d583a630dc0cfd4729e4e069dbb05176fad5bce (diff) | |
| parent | 9b2eecf42fd16f02f67f616f2a95ca3c358c15d2 (diff) | |
| download | cgeo-1c728393b8a9024de872c715da8b211e2da8010e.zip cgeo-1c728393b8a9024de872c715da8b211e2da8010e.tar.gz cgeo-1c728393b8a9024de872c715da8b211e2da8010e.tar.bz2 | |
Merge pull request #1068 from marco-jacob/issue#664
Fix for Issue #664
Diffstat (limited to 'main/src/cgeo')
| -rw-r--r-- | main/src/cgeo/geocaching/cgeoadvsearch.java | 2 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeocoords.java | 24 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeopoint.java | 2 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeowaypointadd.java | 3 |
4 files changed, 27 insertions, 4 deletions
diff --git a/main/src/cgeo/geocaching/cgeoadvsearch.java b/main/src/cgeo/geocaching/cgeoadvsearch.java index 0951b31..754cbdb 100644 --- a/main/src/cgeo/geocaching/cgeoadvsearch.java +++ b/main/src/cgeo/geocaching/cgeoadvsearch.java @@ -263,7 +263,7 @@ public class cgeoadvsearch extends AbstractActivity { @Override public void onClick(View arg0) { - cgeocoords coordsDialog = new cgeocoords(cgeoadvsearch.this, null, geo); + cgeocoords coordsDialog = new cgeocoords(cgeoadvsearch.this, null, null, geo); coordsDialog.setCancelable(true); coordsDialog.setOnCoordinateUpdate(new cgeocoords.CoordinateUpdate() { @Override diff --git a/main/src/cgeo/geocaching/cgeocoords.java b/main/src/cgeo/geocaching/cgeocoords.java index 367fb22..3aadf05 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,12 @@ 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); + if (cache != null) { + buttonCache.setOnClickListener(new CacheListener()); + } else { + buttonCache.setVisibility(View.GONE); + } final Button buttonDone = (Button) findViewById(R.id.done); buttonDone.setOnClickListener(new InputDoneListener()); } @@ -481,6 +489,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/cgeopoint.java b/main/src/cgeo/geocaching/cgeopoint.java index 5d109c4..1800b72 100644 --- a/main/src/cgeo/geocaching/cgeopoint.java +++ b/main/src/cgeo/geocaching/cgeopoint.java @@ -285,7 +285,7 @@ public class cgeopoint extends AbstractActivity { if (latButton.getText().length() > 0 && lonButton.getText().length() > 0) { gp = new Geopoint(latButton.getText().toString() + " " + lonButton.getText().toString()); } - cgeocoords coordsDialog = new cgeocoords(cgeopoint.this, gp, geo); + cgeocoords coordsDialog = new cgeocoords(cgeopoint.this, null, gp, geo); coordsDialog.setCancelable(true); coordsDialog.setOnCoordinateUpdate(new cgeocoords.CoordinateUpdate() { @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 |
