aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/maps/CGeoMap.java
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2014-03-06 09:18:09 +0100
committerSamuel Tardieu <sam@rfc1149.net>2014-03-06 20:02:00 +0100
commit291a622a9d8b1e5c791157a61e5ef467710be42d (patch)
tree6002e29c7adec7742e27956cab5bd4ffa37a0bf7 /main/src/cgeo/geocaching/maps/CGeoMap.java
parent48b7cbaa0b469794088d41038192366fea802190 (diff)
downloadcgeo-291a622a9d8b1e5c791157a61e5ef467710be42d.zip
cgeo-291a622a9d8b1e5c791157a61e5ef467710be42d.tar.gz
cgeo-291a622a9d8b1e5c791157a61e5ef467710be42d.tar.bz2
Always use a combined geodata and direction provider
Diffstat (limited to 'main/src/cgeo/geocaching/maps/CGeoMap.java')
-rw-r--r--main/src/cgeo/geocaching/maps/CGeoMap.java26
1 files changed, 6 insertions, 20 deletions
diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java
index 81fd693..8b6764d 100644
--- a/main/src/cgeo/geocaching/maps/CGeoMap.java
+++ b/main/src/cgeo/geocaching/maps/CGeoMap.java
@@ -3,9 +3,7 @@ package cgeo.geocaching.maps;
import cgeo.geocaching.CacheListActivity;
import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.DataStore;
-import cgeo.geocaching.DirectionProvider;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.sensors.IGeoData;
import cgeo.geocaching.R;
import cgeo.geocaching.SearchResult;
import cgeo.geocaching.Waypoint;
@@ -31,18 +29,18 @@ import cgeo.geocaching.maps.interfaces.MapProvider;
import cgeo.geocaching.maps.interfaces.MapSource;
import cgeo.geocaching.maps.interfaces.MapViewImpl;
import cgeo.geocaching.maps.interfaces.OnMapDragListener;
+import cgeo.geocaching.sensors.GeoDirHandler;
+import cgeo.geocaching.sensors.IGeoData;
import cgeo.geocaching.settings.Settings;
import cgeo.geocaching.ui.dialog.LiveMapInfoDialogBuilder;
import cgeo.geocaching.utils.AngleUtils;
import cgeo.geocaching.utils.CancellableHandler;
-import cgeo.geocaching.sensors.GeoDirHandler;
import cgeo.geocaching.utils.LeastRecentlyUsedSet;
import cgeo.geocaching.utils.Log;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.HashCodeBuilder;
-
import rx.functions.Action1;
import android.app.Activity;
@@ -492,7 +490,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
public void onResume() {
super.onResume();
- geoDirUpdate.startGeoAndDir();
+ geoDirUpdate.start();
if (!CollectionUtils.isEmpty(dirtyCaches)) {
for (String geocode : dirtyCaches) {
@@ -515,7 +513,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
@Override
public void onPause() {
stopTimer();
- geoDirUpdate.stopGeoAndDir();
+ geoDirUpdate.stop();
savePrefs();
if (mapView != null) {
@@ -887,26 +885,14 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
private long timeLastPositionOverlayCalculation = 0;
@Override
- public void updateGeoData(final IGeoData geo) {
+ public void updateGeoDir(final IGeoData geo, final float dir) {
if (geo.isPseudoLocation()) {
locationValid = false;
} else {
locationValid = true;
currentLocation = geo.getLocation();
-
- if (!Settings.isUseCompass() || geo.getSpeed() > 5) { // use GPS when speed is higher than 18 km/h
- currentHeading = geo.getBearing();
- }
-
- repaintPositionOverlay();
- }
- }
-
- @Override
- public void updateDirection(final float direction) {
- if (app.currentGeo().getSpeed() <= 5) { // use compass when speed is lower than 18 km/h
- currentHeading = DirectionProvider.getDirectionNow(activity, direction);
+ currentHeading = dir;
repaintPositionOverlay();
}
}