Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2016-11-27 20:51:45 +01:00
commit 8fa803ffe9
2 changed files with 5 additions and 6 deletions

View file

@ -166,7 +166,7 @@ public class OsmAndFormatter {
public static String getFormattedAlt(double alt, OsmandApplication ctx) { public static String getFormattedAlt(double alt, OsmandApplication ctx) {
OsmandSettings settings = ctx.getSettings(); OsmandSettings settings = ctx.getSettings();
MetricsConstants mc = settings.METRIC_SYSTEM.get(); MetricsConstants mc = settings.METRIC_SYSTEM.get();
boolean useFeet = ((mc == MetricsConstants.MILES_AND_FEET) || (mc == MetricsConstants.MILES_AND_YARDS)); boolean useFeet = (mc == MetricsConstants.MILES_AND_FEET) || (mc == MetricsConstants.MILES_AND_YARDS);
if (!useFeet) { if (!useFeet) {
return ((int) (alt + 0.5)) + " " + ctx.getString(R.string.m); return ((int) (alt + 0.5)) + " " + ctx.getString(R.string.m);
} else { } else {

View file

@ -38,11 +38,10 @@ public class ElevationView extends ImageView {
public void onDraw(Canvas canvas) { public void onDraw(Canvas canvas) {
final float screenScale = getResources().getDisplayMetrics().density; final float screenScale = getResources().getDisplayMetrics().density;
//TODO: Hardy: Perhaps also support feet in graph final boolean useFeet = (mc == MetricsConstants.MILES_AND_FEET) || (mc == MetricsConstants.MILES_AND_YARDS);
boolean useFeet = ((mc == MetricsConstants.MILES_AND_FEET) || (mc == MetricsConstants.MILES_AND_YARDS)); final String unit = useFeet ? app.getString(R.string.foot) : app.getString(R.string.m);
String unit = useFeet ? app.getString(R.string.foot) : app.getString(R.string.m); final int stepBase = useFeet ? 200 : 100;
int stepBase = useFeet ? 200 : 100; final float convEle = useFeet ? 3.28084f : 1.0f;
float convEle = useFeet ? 3.28084f : 1.0f;
final int maxBase = ((int)(maxElevation * convEle / stepBase) + 1) * stepBase, minBase = (int)(minElevation * convEle / stepBase) * stepBase; final int maxBase = ((int)(maxElevation * convEle / stepBase) + 1) * stepBase, minBase = (int)(minElevation * convEle / stepBase) * stepBase;
final float yDistance = (maxBase - minBase); final float yDistance = (maxBase - minBase);