From 3756fdc63733ced8833f1c6626a1f21f7a4d923a Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Jun 2014 19:07:33 +0300 Subject: [PATCH 1/2] fixed issue with geo targeting on string geo:59.5,29.5?z=18&q=59.5,29.5. Jira bug 107 --- .../plus/activities/search/GeoIntentActivity.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java index 08968b1f51..4113c21362 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java @@ -105,6 +105,8 @@ public class GeoIntentActivity extends OsmandListActivity { { Thread.sleep(200); } + String scheme = intent.getScheme(); + Uri data = intent.getData(); return extract(intent.getScheme(), intent.getData()).execute(); } catch (Exception e) @@ -312,8 +314,15 @@ public class GeoIntentActivity extends OsmandListActivity { //geo:47.6,-122.3?z=11 //allow for http://tools.ietf.org/html/rfc5870 (geo uri) , just ignore everything after ';' final String pattern = "([\\-0-9.]+),([\\-0-9.]+)(?:,([\\-0-9.]+))?(?:\\?z=([0-9]+))?(?:;.*)?"; + int indexQ = schemeSpecific.indexOf("&q"); + final Matcher matcher; + if (indexQ != -1){ + final String schemeQ = schemeSpecific.substring(0,indexQ); + matcher = Pattern.compile(pattern).matcher(schemeQ); + } else { + matcher = Pattern.compile(pattern).matcher(schemeSpecific); + } - final Matcher matcher = Pattern.compile(pattern).matcher(schemeSpecific); if (matcher.matches()) { final double lat = Double.valueOf(matcher.group(1)); From b4a316160df4a492f318a22950030682584d753d Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Jun 2014 19:09:04 +0300 Subject: [PATCH 2/2] hotfix --- .../net/osmand/plus/activities/search/GeoIntentActivity.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java index 4113c21362..f38e6096ec 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java @@ -105,8 +105,6 @@ public class GeoIntentActivity extends OsmandListActivity { { Thread.sleep(200); } - String scheme = intent.getScheme(); - Uri data = intent.getData(); return extract(intent.getScheme(), intent.getData()).execute(); } catch (Exception e)