diff options
author | blafoo <github@blafoo.de> | 2012-05-17 20:20:59 +0200 |
---|---|---|
committer | blafoo <github@blafoo.de> | 2012-05-17 20:20:59 +0200 |
commit | c42b5697a1c7cadc4acf345f848d6d076bad9e17 (patch) | |
tree | 7bc9ee42397fbd297ee412ebd005fe36ddced79d | |
parent | b282445f7a899847254abcf2fafdc70566d090a8 (diff) | |
download | cgeo-c42b5697a1c7cadc4acf345f848d6d076bad9e17.zip cgeo-c42b5697a1c7cadc4acf345f848d6d076bad9e17.tar.gz cgeo-c42b5697a1c7cadc4acf345f848d6d076bad9e17.tar.bz2 |
Correct speed in Live Map. Fixes #1300
-rw-r--r-- | main/src/cgeo/geocaching/connector/gc/GCMap.java | 15 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/maps/CGeoMap.java | 8 |
2 files changed, 14 insertions, 9 deletions
diff --git a/main/src/cgeo/geocaching/connector/gc/GCMap.java b/main/src/cgeo/geocaching/connector/gc/GCMap.java index 1e2754c..a8509b8 100644 --- a/main/src/cgeo/geocaching/connector/gc/GCMap.java +++ b/main/src/cgeo/geocaching/connector/gc/GCMap.java @@ -234,26 +234,25 @@ public class GCMap { * @return */ public static SearchResult searchByViewport(final Viewport viewport, final String[] tokens) { + int speed = (int) cgeoapplication.getInstance().currentGeo().getSpeed() * 60 * 60 / 1000; // in km/h Strategy strategy = Settings.getLiveMapStrategy(); if (strategy == Strategy.AUTO) { - float speedNow = cgeoapplication.getInstance().currentGeo().getSpeed(); - strategy = speedNow >= 8 ? Strategy.FAST : Strategy.DETAILED; // 8 m/s = 30 km/h + strategy = speed >= 30 ? Strategy.FAST : Strategy.DETAILED; } - // return searchByViewport(viewport, tokens, strategy); - // testing purpose - { - SearchResult result = searchByViewport(viewport, tokens, strategy); + SearchResult result = searchByViewport(viewport, tokens, strategy); + + if (Settings.isDebug()) { String text = Formatter.SEPARATOR + strategy.getL10n() + Formatter.SEPARATOR; - int speed = (int) cgeoapplication.getInstance().currentGeo().getSpeed(); if (Settings.isUseMetricUnits()) { text += speed + " km/h"; } else { text += speed / IConversion.MILES_TO_KILOMETER + " mph"; } result.setUrl(result.getUrl() + text); - return result; } + + return result; } /** diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java index 3e61e09..eaf5bc8 100644 --- a/main/src/cgeo/geocaching/maps/CGeoMap.java +++ b/main/src/cgeo/geocaching/maps/CGeoMap.java @@ -1,7 +1,6 @@ package cgeo.geocaching.maps; import cgeo.geocaching.DirectionProvider; -import cgeo.geocaching.utils.GeoDirHandler; import cgeo.geocaching.IGeoData; import cgeo.geocaching.IWaypoint; import cgeo.geocaching.LiveMapInfo; @@ -36,6 +35,7 @@ import cgeo.geocaching.maps.interfaces.MapViewImpl; import cgeo.geocaching.maps.interfaces.OnMapDragListener; import cgeo.geocaching.maps.interfaces.OtherCachersOverlayItemImpl; import cgeo.geocaching.utils.CancellableHandler; +import cgeo.geocaching.utils.GeoDirHandler; import cgeo.geocaching.utils.LeastRecentlyUsedSet; import cgeo.geocaching.utils.Log; @@ -219,6 +219,12 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto title.append(']'); } + if (Settings.isDebug()) { + if (search != null && StringUtils.isNotBlank(search.getUrl())) { + title.append("[" + search.getUrl() + "]"); + } + } + ActivityMixin.setTitle(activity, title.toString()); break; case INVALIDATE_MAP: |