mirror of
https://github.com/zxing/zxing.git
synced 2025-01-29 12:01:20 -08:00
Normalize GEO: to geo:
git-svn-id: https://zxing.googlecode.com/svn/trunk@873 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
415c9257d6
commit
6fe022eb10
|
@ -38,12 +38,7 @@ final class GeoResultParser extends ResultParser {
|
||||||
}
|
}
|
||||||
// Drop geo, query portion
|
// Drop geo, query portion
|
||||||
int queryStart = rawText.indexOf('?', 4);
|
int queryStart = rawText.indexOf('?', 4);
|
||||||
String geoURIWithoutQuery;
|
String geoURIWithoutQuery = queryStart < 0 ? rawText.substring(4) : rawText.substring(4, queryStart);
|
||||||
if (queryStart < 0) {
|
|
||||||
geoURIWithoutQuery = rawText.substring(4);
|
|
||||||
} else {
|
|
||||||
geoURIWithoutQuery = rawText.substring(4, queryStart);
|
|
||||||
}
|
|
||||||
int latitudeEnd = geoURIWithoutQuery.indexOf(',');
|
int latitudeEnd = geoURIWithoutQuery.indexOf(',');
|
||||||
if (latitudeEnd < 0) {
|
if (latitudeEnd < 0) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -62,7 +57,8 @@ final class GeoResultParser extends ResultParser {
|
||||||
} catch (NumberFormatException nfe) {
|
} catch (NumberFormatException nfe) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new GeoParsedResult(rawText, latitude, longitude, altitude);
|
return new GeoParsedResult(rawText.startsWith("GEO:") ? "geo:" + rawText.substring(4) : rawText,
|
||||||
|
latitude, longitude, altitude);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue