Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2017-04-01 15:18:35 +02:00
commit 254e10d4dc
2 changed files with 16 additions and 19 deletions

View file

@ -178,12 +178,13 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
zoom = autozoom(location);
}
int currentMapRotation = settings.ROTATE_MAP.get();
boolean smallSpeed = isSmallSpeedForCompass(location);
boolean smallSpeedForCompass = isSmallSpeedForCompass(location);
boolean smallSpeedForAnimation = isSmallSpeedForAnimation(location);
// boolean virtualBearing = fMode && settings.SNAP_TO_ROAD.get();
showViewAngle = (!location.hasBearing() || smallSpeed) && (tb != null &&
showViewAngle = (!location.hasBearing() || smallSpeedForCompass) && (tb != null &&
tb.containsLatLon(location.getLatitude(), location.getLongitude()));
if (currentMapRotation == OsmandSettings.ROTATE_MAP_BEARING) {
if (location.hasBearing() && !smallSpeed) {
if (location.hasBearing() && !smallSpeedForCompass) {
// special case when bearing equals to zero (we don't change anything)
if (location.getBearing() != 0f) {
rotation = -location.getBearing();
@ -193,7 +194,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
showViewAngle = routePlanningMode; // disable compass rotation in that mode
}
registerUnregisterSensor(location);
if (settings.ANIMATE_MY_LOCATION.get()) {
if (settings.ANIMATE_MY_LOCATION.get() && !smallSpeedForAnimation) {
mapView.getAnimatedDraggingThread().startMoving(
location.getLatitude(), location.getLongitude(), zoom, rotation, false);
} else {
@ -230,8 +231,11 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
public static boolean isSmallSpeedForCompass(Location location) {
return !location.hasSpeed() || location.getSpeed() < 0.5;
}
public static boolean isSmallSpeedForAnimation(Location location) {
return !location.hasSpeed() || location.getSpeed() < 1.5;
}
public boolean isShowViewAngle() {
return showViewAngle;
}

View file

@ -160,27 +160,18 @@ public class AnimateDraggingMapThread {
public void run() {
setTargetValues(zoom, finalLat, finalLon);
boolean animateZoom = finalZoom != null && (zoom != startZoom || startZoomFP != 0);
boolean animateRotation = rotation != startRotaton;
if (animateZoom) {
animatingZoomInThread(startZoom, startZoomFP, zoom, zoomFP, NAV_ANIMATION_TIME, notifyListener);
}
if (rotation != startRotaton) {
AnimateDraggingMapThread.this.targetRotate = rotation;
//animatingRotateInThread(rotation, NAV_ANIMATION_TIME, notifyListener);
if (animateRotation) {
animatingRotateInThread(rotation, 500f, notifyListener);
}
pendingRotateAnimation();
if (!stopped){
animatingMoveInThread(mMoveX, mMoveY, NAV_ANIMATION_TIME, notifyListener);
}
if (!stopped){
//tileView.setLatLonAnimate(finalLat, finalLon, notifyListener);
}
if (animateZoom) {
//tileView.setFractionalZoom(zoom, zoomFP, notifyListener);
}
}
});
}
@ -254,6 +245,7 @@ public class AnimateDraggingMapThread {
while (!stopped) {
normalizedTime = (SystemClock.uptimeMillis() - timeMillis) / animationTime;
if (normalizedTime > 1f) {
tileView.rotateToAnimate(rotate);
break;
}
float interpolation = interpolator.getInterpolation(normalizedTime);
@ -264,8 +256,9 @@ public class AnimateDraggingMapThread {
stopped = true;
}
}
} else {
tileView.rotateToAnimate(rotate);
}
tileView.rotateToAnimate(rotate);
}
private void animatingMoveInThread(float moveX, float moveY, float animationTime,