Fix metrics fix
This commit is contained in:
parent
b4734ca136
commit
f411eaf2dd
3 changed files with 14 additions and 6 deletions
|
@ -104,15 +104,23 @@ public class OsmAndFormatter {
|
||||||
if (kmh >= 15 || (am == ApplicationMode.CAR)) {
|
if (kmh >= 15 || (am == ApplicationMode.CAR)) {
|
||||||
return ((int) kmh) + " " + ctx.getString(R.string.km_h);
|
return ((int) kmh) + " " + ctx.getString(R.string.km_h);
|
||||||
}
|
}
|
||||||
kmh = ((int) kmh * 10f) / 10f;
|
int kmh10 = (int) (kmh * 10f);
|
||||||
return kmh + " " + ctx.getString(R.string.km_h);
|
if (kmh10 % 10 == 0) {
|
||||||
|
return (kmh10 / 10) + " " + ctx.getString(R.string.km_h);
|
||||||
|
} else {
|
||||||
|
return (kmh10 / 10f) + " " + ctx.getString(R.string.km_h);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
float mph = kmh * METERS_IN_KILOMETER / METERS_IN_ONE_MILE;
|
float mph = kmh * METERS_IN_KILOMETER / METERS_IN_ONE_MILE;
|
||||||
if (mph >= 10) {
|
if (mph >= 10) {
|
||||||
return ((int) (mph)) + " " + ctx.getString(R.string.mile_per_hour);
|
return ((int) (mph)) + " " + ctx.getString(R.string.mile_per_hour);
|
||||||
} else {
|
} else {
|
||||||
mph = ((int) mph * 10f) / 10f;
|
int mph10 = (int) (mph * 10f);
|
||||||
return mph + " " + ctx.getString(R.string.mile_per_hour);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -409,7 +409,7 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private boolean distChanged(int oldDist, int dist){
|
private boolean distChanged(int oldDist, int dist){
|
||||||
if(oldDist != 0 && oldDist - dist < 30){
|
if(oldDist != 0 && Math.abs(oldDist - dist) > 30){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -603,7 +603,7 @@ public class RouteInfoControls {
|
||||||
|
|
||||||
|
|
||||||
public boolean distChanged(int oldDist, int dist){
|
public boolean distChanged(int oldDist, int dist){
|
||||||
if(oldDist != 0 && oldDist - dist < 10){
|
if(oldDist != 0 && Math.abs(oldDist - dist) > 10){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue