try alternative speed/zoome hysteresis prevention, solves bug that zoom is not adjusted in many cases wher adjustment by 1 is needed

This commit is contained in:
sonora 2012-03-13 20:13:24 +01:00
parent 7aa44d9829
commit 72a4ae7158

View file

@ -713,7 +713,7 @@ public class MapActivity extends TrackedActivity implements IMapLocationListener
if(mapView.getZoom() != z && !mapView.mapIsAnimating()){ if(mapView.getZoom() != z && !mapView.mapIsAnimating()){
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
// prevent ui hysterisis (check time interval for autozoom) // prevent ui hysterisis (check time interval for autozoom)
if(Math.abs(mapView.getZoom() - z) > 1 || (lastTimeAutoZooming - now) > 6500){ if((lastTimeAutoZooming - now) > 6500){
lastTimeAutoZooming = now; lastTimeAutoZooming = now;
mapView.setZoom(z); mapView.setZoom(z);
} }
@ -740,10 +740,10 @@ public class MapActivity extends TrackedActivity implements IMapLocationListener
public int defineZoomFromSpeed(float speed, int currentZoom){ public int defineZoomFromSpeed(float speed, int currentZoom){
speed *= 3.6; speed *= 3.6;
if(speed < 4){ if(speed < 5){
return currentZoom; return currentZoom;
// less than 23: show zoom 17
} else if(speed < 23){ } else if(speed < 23){
// less than 23 - show 17
return 17; return 17;
} else if(speed < 43){ } else if(speed < 43){
return 16; return 16;