Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2016-11-30 20:55:38 +01:00
commit b6758bf9f1

View file

@ -40,12 +40,15 @@ public class ElevationView extends ImageView {
final boolean useFeet = (mc == MetricsConstants.MILES_AND_FEET) || (mc == MetricsConstants.MILES_AND_YARDS); final 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); final 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; final float convEle = useFeet ? 3.28084f : 1.0f;
final int maxBase = ((int)Math.floor((maxElevation * convEle / stepBase) + 1)) * stepBase; final int maxBase = ((int)Math.floor((maxElevation * convEle / stepBase) + 1)) * stepBase;
final int minBase = (int)Math.floor((minElevation * convEle / stepBase)) * stepBase; final int minBase = (int)Math.floor((minElevation * convEle / stepBase)) * stepBase;
final float yDistance = maxBase - minBase; final float yDistance = maxBase - minBase;
if ((!useFeet && (yDistance <= 100)) || (useFeet && (yDistance <= 200))) { //Draw 50m/100ft markers for smallest scale
stepBase = stepBase/2;
}
final float xPer = (float)canvas.getWidth() / xDistance; final float xPer = (float)canvas.getWidth() / xDistance;
final float yPer = (float)canvas.getHeight() / yDistance; final float yPer = (float)canvas.getHeight() / yDistance;
final float canvasRight = (float)canvas.getWidth() - 1f; final float canvasRight = (float)canvas.getWidth() - 1f;