Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2012-09-07 19:41:12 +02:00
commit ced810107b
4 changed files with 22 additions and 8 deletions

View file

@ -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);
}
} }
} }
} }

View file

@ -463,7 +463,10 @@ public class MapActivityActions implements DialogProvider {
return; return;
} }
routingHelper.setAppMode(mode); routingHelper.setAppMode(mode);
// Do not overwrite PREV_APPLICATION_MODE if already navigating
if (!routingHelper.isFollowingMode()) {
settings.PREV_APPLICATION_MODE.set(settings.APPLICATION_MODE.get()); settings.PREV_APPLICATION_MODE.set(settings.APPLICATION_MODE.get());
}
settings.FOLLOW_THE_ROUTE.set(false); settings.FOLLOW_THE_ROUTE.set(false);
settings.FOLLOW_THE_GPX_ROUTE.set(null); settings.FOLLOW_THE_GPX_ROUTE.set(null);
routingHelper.setFollowingMode(false); routingHelper.setFollowingMode(false);
@ -492,7 +495,10 @@ public class MapActivityActions implements DialogProvider {
} }
ApplicationMode mode = getAppMode(buttons, settings); ApplicationMode mode = getAppMode(buttons, settings);
// change global settings // change global settings
// Do not overwrite PREV_APPLICATION_MODE if already navigating
if (!routingHelper.isFollowingMode()) {
settings.PREV_APPLICATION_MODE.set(settings.APPLICATION_MODE.get()); settings.PREV_APPLICATION_MODE.set(settings.APPLICATION_MODE.get());
}
boolean changed = settings.APPLICATION_MODE.set(mode); boolean changed = settings.APPLICATION_MODE.set(mode);
if (changed) { if (changed) {
mapActivity.updateApplicationModeSettings(); mapActivity.updateApplicationModeSettings();

View file

@ -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;

View file

@ -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;