Fix #6386 - introduce parsing for displaycolor
This commit is contained in:
parent
f6f9c3644e
commit
703204ce19
1 changed files with 13 additions and 3 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue