diff options
author | Bananeweizen <bananeweizen@gmx.de> | 2015-04-19 10:20:31 +0200 |
---|---|---|
committer | Bananeweizen <bananeweizen@gmx.de> | 2015-04-19 10:20:31 +0200 |
commit | 59b8b2e26a7fff6072c4d5d96f51035dc900e0bc (patch) | |
tree | 51d819b495a8b7841389ac7805b22bfefc5f5ff0 | |
parent | e09c4931810c062f15da24355343fa253e483f47 (diff) | |
download | cgeo-59b8b2e26a7fff6072c4d5d96f51035dc900e0bc.zip cgeo-59b8b2e26a7fff6072c4d5d96f51035dc900e0bc.tar.gz cgeo-59b8b2e26a7fff6072c4d5d96f51035dc900e0bc.tar.bz2 |
fix #4884: Heading line has wrong target when started from compass
-rw-r--r-- | main/src/cgeo/geocaching/CompassActivity.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/main/src/cgeo/geocaching/CompassActivity.java b/main/src/cgeo/geocaching/CompassActivity.java index e4e1cca..3f6fe6a 100644 --- a/main/src/cgeo/geocaching/CompassActivity.java +++ b/main/src/cgeo/geocaching/CompassActivity.java @@ -56,9 +56,13 @@ public class CompassActivity extends AbstractActionBarActivity { @InjectView(R.id.cacheinfo) protected TextView cacheInfoView; /** - * Destination of the compass, or null (if the compass is used for a waypoint only). + * Destination cache, may be null */ private Geocache cache = null; + /** + * Destination waypoint, may be null + */ + private Waypoint waypoint = null; private Geopoint dstCoords = null; private float cacheHeading = 0; private String description; @@ -188,7 +192,10 @@ public class CompassActivity extends AbstractActionBarActivity { final int id = item.getItemId(); switch (id) { case R.id.menu_map: - if (cache != null) { + if (waypoint != null) { + CGeoMap.startActivityCoords(this, waypoint.getCoords(), waypoint.getWaypointType(), waypoint.getName()); + } + else if (cache != null) { CGeoMap.startActivityGeoCode(this, cache.getGeocode()); } else { @@ -247,8 +254,9 @@ public class CompassActivity extends AbstractActionBarActivity { Log.d("destination set: " + newDescription + " (" + dstCoords + ")"); } - private void setTarget(final @NonNull Waypoint waypoint) { - setTarget(waypoint.getCoords(), waypoint.getName()); + private void setTarget(final @NonNull Waypoint waypointIn) { + waypoint = waypointIn; + setTarget(waypointIn.getCoords(), waypointIn.getName()); } private void setTarget(final Geocache cache) { |