Fix #6386 - introduce parsing for displaycolor

This commit is contained in:
Victor Shcherb 2018-12-26 21:25:43 +01:00
parent f6f9c3644e
commit 703204ce19

View file

@ -75,9 +75,18 @@ public class GPXUtilities {
@ColorInt
public int getColor(@ColorInt int defColor) {
if (extensions != null && extensions.containsKey("color")) {
if (extensions != null) {
String clrValue = extensions.get("color");
if (clrValue == null) {
clrValue = extensions.get("colour");
}
if (clrValue == null) {
clrValue = extensions.get("displaycolor");
}
}
if (clrValue != null && clrValue.length() > 0) {
try {
return Color.parseColor(extensions.get("color").toUpperCase());
return Color.parseColor(clrValue.toUpperCase());
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
@ -107,6 +116,7 @@ public class GPXUtilities {
public int time;
public float elevation;
}
public static class Speed {
public float distance;
public int time;
@ -1502,7 +1512,7 @@ public class GPXUtilities {
if (extensionReadMode && parse instanceof GPXExtensions) {
String value = readText(parser, tag);
if (value != null) {
((GPXExtensions) parse).getExtensionsToWrite().put(tag, value);
((GPXExtensions) parse).getExtensionsToWrite().put(tag.toLowerCase(), value);
if (tag.equals("speed") && parse instanceof WptPt) {
try {
((WptPt) parse).speed = Float.parseFloat(value);