commit
eb3fc0ad3d
5 changed files with 14 additions and 12 deletions
|
@ -499,8 +499,8 @@ public class OsmAndLocationProvider implements SensorEventListener {
|
|||
}
|
||||
|
||||
private float calcGeoMagneticCorrection(float val) {
|
||||
if (previousCorrectionValue == 360 && getLastKnownLocation() != null) {
|
||||
net.osmand.Location l = getLastKnownLocation();
|
||||
net.osmand.Location l = getLastKnownLocation();
|
||||
if (previousCorrectionValue == 360 && l != null) {
|
||||
GeomagneticField gf = new GeomagneticField((float) l.getLatitude(), (float) l.getLongitude(), (float) l.getAltitude(),
|
||||
System.currentTimeMillis());
|
||||
previousCorrectionValue = gf.getDeclination();
|
||||
|
|
|
@ -980,8 +980,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
|||
if (app != null && view != null) {
|
||||
View compassView = view.findViewById(R.id.compass_layout);
|
||||
Location ll = app.getLocationProvider().getLastKnownLocation();
|
||||
boolean gpsFixed = ll != null && System.currentTimeMillis() - ll.getTime() < 1000 * 60 * 60 * 20;
|
||||
if (gpsFixed && menu.displayDistanceDirection() && menu.getCurrentMenuState() != MenuState.FULL_SCREEN) {
|
||||
if (ll != null && menu.displayDistanceDirection() && menu.getCurrentMenuState() != MenuState.FULL_SCREEN) {
|
||||
updateDistanceDirection();
|
||||
compassView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
|
|
|
@ -27,6 +27,7 @@ import android.widget.SeekBar;
|
|||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.core.android.MapRendererContext;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
|
@ -794,8 +795,8 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
}
|
||||
|
||||
private void updateMyLocation(RoutingHelper rh, boolean dialogOpened) {
|
||||
boolean enabled = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation() != null &&
|
||||
!isLocationOutdated(mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation());
|
||||
Location lastKnownLocation = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation();
|
||||
boolean enabled = lastKnownLocation != null && !isLocationOutdated(lastKnownLocation);
|
||||
boolean tracked = mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation();
|
||||
|
||||
if (!enabled) {
|
||||
|
|
|
@ -86,9 +86,9 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
|
|||
}
|
||||
// draw
|
||||
boolean nm = nightMode != null && nightMode.isNightMode();
|
||||
updateIcons(view.getSettings().getApplicationMode(), nm,
|
||||
isLocationOutdated(locationProvider.getLastKnownLocation()));
|
||||
Location lastKnownLocation = locationProvider.getLastKnownLocation();
|
||||
updateIcons(view.getSettings().getApplicationMode(), nm,
|
||||
isLocationOutdated(lastKnownLocation));
|
||||
if(lastKnownLocation == null || view == null){
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -718,18 +718,20 @@ public class MapInfoWidgetsFactory {
|
|||
settings.SHOW_STREET_NAME.get()) {
|
||||
RouteDataObject rt = locationProvider.getLastKnownRouteSegment();
|
||||
if (rt != null) {
|
||||
Location lastKnownLocation = locationProvider.getLastKnownLocation();
|
||||
text = RoutingHelper.formatStreetName(
|
||||
rt.getName(settings.MAP_PREFERRED_LOCALE.get(), settings.MAP_TRANSLITERATE_NAMES.get()),
|
||||
rt.getRef(settings.MAP_PREFERRED_LOCALE.get(), settings.MAP_TRANSLITERATE_NAMES.get(), rt.bearingVsRouteDirection(locationProvider.getLastKnownLocation())),
|
||||
rt.getDestinationName(settings.MAP_PREFERRED_LOCALE.get(), settings.MAP_TRANSLITERATE_NAMES.get(), rt.bearingVsRouteDirection(locationProvider.getLastKnownLocation())),
|
||||
rt.getRef(settings.MAP_PREFERRED_LOCALE.get(), settings.MAP_TRANSLITERATE_NAMES.get(), rt.bearingVsRouteDirection(lastKnownLocation)),
|
||||
rt.getDestinationName(settings.MAP_PREFERRED_LOCALE.get(), settings.MAP_TRANSLITERATE_NAMES.get(), rt.bearingVsRouteDirection(lastKnownLocation)),
|
||||
"»");
|
||||
}
|
||||
if (text == null) {
|
||||
text = "";
|
||||
} else {
|
||||
if(!Algorithms.isEmpty(text) && locationProvider.getLastKnownLocation() != null) {
|
||||
Location lastKnownLocation = locationProvider.getLastKnownLocation();
|
||||
if(!Algorithms.isEmpty(text) && lastKnownLocation != null) {
|
||||
double dist =
|
||||
CurrentPositionHelper.getOrthogonalDistance(rt, locationProvider.getLastKnownLocation());
|
||||
CurrentPositionHelper.getOrthogonalDistance(rt, lastKnownLocation);
|
||||
if(dist < 50) {
|
||||
showMarker = true;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue