Fix metrics fix

This commit is contained in:
Victor Shcherb 2012-09-07 15:08:36 +02:00
parent b4734ca136
commit f411eaf2dd
3 changed files with 14 additions and 6 deletions

View file

@ -104,15 +104,23 @@ public class OsmAndFormatter {
if (kmh >= 15 || (am == ApplicationMode.CAR)) {
return ((int) kmh) + " " + ctx.getString(R.string.km_h);
}
kmh = ((int) kmh * 10f) / 10f;
return kmh + " " + ctx.getString(R.string.km_h);
int kmh10 = (int) (kmh * 10f);
if (kmh10 % 10 == 0) {
return (kmh10 / 10) + " " + ctx.getString(R.string.km_h);
} else {
return (kmh10 / 10f) + " " + ctx.getString(R.string.km_h);
}
} else {
float mph = kmh * METERS_IN_KILOMETER / METERS_IN_ONE_MILE;
if (mph >= 10) {
return ((int) (mph)) + " " + ctx.getString(R.string.mile_per_hour);
} else {
mph = ((int) mph * 10f) / 10f;
return mph + " " + ctx.getString(R.string.mile_per_hour);
int mph10 = (int) (mph * 10f);
if(mph10 % 10 == 0) {
return (mph10 / 10) + " " + ctx.getString(R.string.mile_per_hour);
} else {
return (mph10 / 10f) + " " + ctx.getString(R.string.mile_per_hour);
}
}
}
}

View file

@ -409,7 +409,7 @@ public class ParkingPositionPlugin extends OsmandPlugin {
* @return
*/
private boolean distChanged(int oldDist, int dist){
if(oldDist != 0 && oldDist - dist < 30){
if(oldDist != 0 && Math.abs(oldDist - dist) > 30){
return false;
}
return true;

View file

@ -603,7 +603,7 @@ public class RouteInfoControls {
public boolean distChanged(int oldDist, int dist){
if(oldDist != 0 && oldDist - dist < 10){
if(oldDist != 0 && Math.abs(oldDist - dist) > 10){
return false;
}
return true;