Merge pull request #10745 from osmandapp/fix_speed_unit_minsec

fix speed unit setting for "min/km" to show seconds instead of fracti…
This commit is contained in:
vshcherb 2021-02-02 14:07:19 +01:00 committed by GitHub
commit 3beb39976d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -344,8 +344,8 @@ public class OsmAndFormatter {
if (minperkm >= 10) { if (minperkm >= 10) {
return ((int) Math.round(minperkm)) + " " + mc.toShortString(ctx); return ((int) Math.round(minperkm)) + " " + mc.toShortString(ctx);
} else { } else {
int mph10 = (int) Math.round(minperkm * 10f); int seconds = Math.round(minperkm * 60);
return (mph10 / 10f) + " " + mc.toShortString(ctx); return Algorithms.formatDuration(seconds, false) + " " + mc.toShortString(ctx);
} }
} else if (mc == SpeedConstants.MINUTES_PER_MILE) { } else if (mc == SpeedConstants.MINUTES_PER_MILE) {
if (metersperseconds < 0.111111111) { if (metersperseconds < 0.111111111) {