Fix navigation intent regexp (c:geo and others) and restore support for c:geo geo intent
This commit is contained in:
parent
f5fb91e4a1
commit
d05afc1ba7
2 changed files with 9 additions and 4 deletions
|
@ -343,7 +343,7 @@ public class MapActivity extends AccessibleActivity {
|
||||||
} else if ("google.navigation".equals(scheme) || "osmand.navigation".equals(scheme)) {
|
} else if ("google.navigation".equals(scheme) || "osmand.navigation".equals(scheme)) {
|
||||||
final String schemeSpecificPart = data.getSchemeSpecificPart();
|
final String schemeSpecificPart = data.getSchemeSpecificPart();
|
||||||
|
|
||||||
final Matcher matcher = Pattern.compile("q=(.+?),(.+?)").matcher(schemeSpecificPart);
|
final Matcher matcher = Pattern.compile("(?:q|ll)=([\\-0-9.]+),([\\-0-9.]+)(?:.*)").matcher(schemeSpecificPart);
|
||||||
if (matcher.matches()) {
|
if (matcher.matches()) {
|
||||||
try {
|
try {
|
||||||
final double lat = Double.valueOf(matcher.group(1));
|
final double lat = Double.valueOf(matcher.group(1));
|
||||||
|
|
|
@ -320,6 +320,9 @@ public class GeoIntentActivity extends OsmandListActivity {
|
||||||
} else {
|
} else {
|
||||||
matcher = Pattern.compile(pattern).matcher(schemeSpecific);
|
matcher = Pattern.compile(pattern).matcher(schemeSpecific);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final String pattern2 = "([\\-0-9.]+),([\\-0-9.]+)(?:.*)"; //c:geo
|
||||||
|
final Matcher matcher2 = Pattern.compile(pattern2).matcher(schemeSpecific);
|
||||||
|
|
||||||
if (matcher.matches())
|
if (matcher.matches())
|
||||||
{
|
{
|
||||||
|
@ -333,9 +336,11 @@ public class GeoIntentActivity extends OsmandListActivity {
|
||||||
{
|
{
|
||||||
return new GeoPointSearch(lat, lon, Integer.valueOf(matcher.group(4)));
|
return new GeoPointSearch(lat, lon, Integer.valueOf(matcher.group(4)));
|
||||||
}
|
}
|
||||||
}
|
} else if (matcher2.matches()) {
|
||||||
else
|
final double lat = Double.valueOf(matcher2.group(1));
|
||||||
{
|
final double lon = Double.valueOf(matcher2.group(2));
|
||||||
|
return new GeoPointSearch(lat, lon);
|
||||||
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue