Use gray for cached location in context menu

This commit is contained in:
Alexander Sytnyk 2018-01-22 14:56:14 +02:00
parent 5a77b77325
commit dff5f4b906
2 changed files with 19 additions and 5 deletions

View file

@ -85,6 +85,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
private LatLon myLocation;
private Float heading;
private boolean inLocationUpdate = false;
private boolean useCachedLocation;
private boolean appModeChanged;
private boolean appModeListenerAdded;
private boolean autoHide;
@ -1215,14 +1216,26 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
return myLocation;
}
public boolean isUseCachedLocation() {
return useCachedLocation;
}
public Float getHeading() {
return heading;
}
public void updateMyLocation(net.osmand.Location location) {
if (location != null && active && displayDistanceDirection()) {
myLocation = new LatLon(location.getLatitude(), location.getLongitude());
updateLocation(false, true, false);
if (active && displayDistanceDirection()) {
if (location == null) {
location = getMapActivity().getMyApplication().getLocationProvider().getLastStaleKnownLocation();
useCachedLocation = location != null;
} else {
useCachedLocation = false;
}
if (location != null) {
myLocation = new LatLon(location.getLatitude(), location.getLongitude());
updateLocation(false, true, false);
}
}
}

View file

@ -1238,8 +1238,9 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
TextView distanceText = (TextView) view.findViewById(R.id.distance);
ImageView direction = (ImageView) view.findViewById(R.id.direction);
float myHeading = menu.getHeading() == null ? 0f : menu.getHeading();
DashLocationFragment.updateLocationView(false, menu.getMyLocation(), myHeading, direction, distanceText,
menu.getLatLon().getLatitude(), menu.getLatLon().getLongitude(), screenOrientation, app, activity);
int color = menu.isUseCachedLocation() ? R.color.icon_color : 0;
DashLocationFragment.updateLocationView(false, menu.getMyLocation(), myHeading, direction, color, distanceText,
color, menu.getLatLon().getLatitude(), menu.getLatLon().getLongitude(), screenOrientation, app, activity);
}
}