From d05afc1ba7e2728475be93810282b8b43023adfd Mon Sep 17 00:00:00 2001 From: Zahnstocher Date: Wed, 23 Jul 2014 22:02:43 +0200 Subject: [PATCH] Fix navigation intent regexp (c:geo and others) and restore support for c:geo geo intent --- .../src/net/osmand/plus/activities/MapActivity.java | 2 +- .../plus/activities/search/GeoIntentActivity.java | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 45bb9660ae..ff2e996ee6 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -343,7 +343,7 @@ public class MapActivity extends AccessibleActivity { } else if ("google.navigation".equals(scheme) || "osmand.navigation".equals(scheme)) { 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()) { try { final double lat = Double.valueOf(matcher.group(1)); diff --git a/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java index f38e6096ec..134129bd9b 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java @@ -320,6 +320,9 @@ public class GeoIntentActivity extends OsmandListActivity { } else { 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()) { @@ -333,9 +336,11 @@ public class GeoIntentActivity extends OsmandListActivity { { return new GeoPointSearch(lat, lon, Integer.valueOf(matcher.group(4))); } - } - else - { + } else if (matcher2.matches()) { + final double lat = Double.valueOf(matcher2.group(1)); + final double lon = Double.valueOf(matcher2.group(2)); + return new GeoPointSearch(lat, lon); + } else { return null; } }