mirror of
https://gitlab.com/oeffi/oeffi.git
synced 2025-07-06 17:38:48 +00:00
AndroidManifest.xml: remove filter for intents once thrown by Google Navigation
This commit is contained in:
parent
da08b96180
commit
7aeee3c505
3 changed files with 1 additions and 118 deletions
|
@ -288,12 +288,6 @@
|
|||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:scheme="geo" />
|
||||
</intent-filter>
|
||||
<!-- thrown by google maps when starting navigation -->
|
||||
<intent-filter android:label="@string/directions_intentfilter_title">
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:scheme="google.navigation" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
|
|
|
@ -43,15 +43,7 @@ public class LocationUriParser {
|
|||
|
||||
final String scheme = uri.getScheme();
|
||||
|
||||
if ("google.navigation".equals(scheme)) {
|
||||
final Location location;
|
||||
if (uri.isOpaque())
|
||||
location = parseGoogleNavigation(uri.getSchemeSpecificPart());
|
||||
else
|
||||
location = parseGoogleNavigation(uri.getQuery());
|
||||
|
||||
return new Location[] { location };
|
||||
} else if ("geo".equals(scheme)) {
|
||||
if ("geo".equals(scheme)) {
|
||||
final Location location = parseGeo(uri.getSchemeSpecificPart().replaceAll(",?\n+", ",+"));
|
||||
|
||||
return new Location[] { location };
|
||||
|
@ -60,25 +52,6 @@ public class LocationUriParser {
|
|||
throw new IllegalArgumentException("cannot parse: '" + encodedUriString + "'");
|
||||
}
|
||||
|
||||
private static Location parseGoogleNavigation(final String query) {
|
||||
final String q = getQueryParameter(query, "q");
|
||||
final String ll = getQueryParameter(query, "ll");
|
||||
final String title = getQueryParameter(query, "title");
|
||||
|
||||
if (ll != null) {
|
||||
return parseAddrParam(ll, title != null ? title : q);
|
||||
} else if (q != null) {
|
||||
final Location location = parseAddrParam(q, title);
|
||||
|
||||
if (location != null)
|
||||
return location;
|
||||
else
|
||||
return new Location(LocationType.ANY, null, null, q);
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("cannot parse: '" + query + "'");
|
||||
}
|
||||
|
||||
private static final Pattern P_URI_GEO = Pattern.compile("(-?\\d*\\.?\\d+),(-?\\d*\\.?\\d+)", Pattern.DOTALL);
|
||||
|
||||
private static Location parseGeo(final String query) throws NumberFormatException {
|
||||
|
|
|
@ -23,90 +23,6 @@ import org.junit.Assert;
|
|||
import org.junit.Test;
|
||||
|
||||
public class LocationUriParserTest {
|
||||
@Test
|
||||
public void googleNavigationThrownByGoogleNow() throws Exception {
|
||||
// "Take me to Alexanderplatz"
|
||||
|
||||
final Location[] results = LocationUriParser.parseLocations(
|
||||
"google.navigation:title=Alexanderplatz,+10178+Berlin&ll=52.521918,13.413215&token=Fb5rIQMdX6vMACFuFuRmwwH8MA&entry=r&mode=d");
|
||||
|
||||
Assert.assertEquals(1, results.length);
|
||||
final Location location = results[0];
|
||||
|
||||
Assert.assertEquals(LocationType.ADDRESS, location.type);
|
||||
Assert.assertEquals(13413215, location.getLonAs1E6());
|
||||
Assert.assertEquals(52521918, location.getLatAs1E6());
|
||||
Assert.assertEquals("Alexanderplatz, 10178 Berlin", location.name);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void googleNavigation() throws Exception {
|
||||
final Location[] results = LocationUriParser.parseLocations(
|
||||
"google.navigation:///?ll=52.512845,13.420671&q=Rungestraße+20,+10179+Berlin&title=c-base&entry=w&opt=+flg=0x3000000");
|
||||
|
||||
Assert.assertEquals(1, results.length);
|
||||
final Location location = results[0];
|
||||
|
||||
Assert.assertEquals(LocationType.ADDRESS, location.type);
|
||||
Assert.assertEquals(13420671, location.getLonAs1E6());
|
||||
Assert.assertEquals(52512845, location.getLatAs1E6());
|
||||
Assert.assertEquals("c-base", location.name);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void googleNavigationOpaque() throws Exception {
|
||||
final Location[] results = LocationUriParser.parseLocations(
|
||||
"google.navigation:q=Work&ll=47.460044860839844,9.6347074508667&mode=d&entry=r&altvia=47.4140989,9.7192978&altvia=47.460046399999996,9.6350649");
|
||||
|
||||
Assert.assertEquals(1, results.length);
|
||||
final Location location = results[0];
|
||||
|
||||
Assert.assertEquals(LocationType.ADDRESS, location.type);
|
||||
Assert.assertEquals(9634707, location.getLonAs1E6());
|
||||
Assert.assertEquals(47460045, location.getLatAs1E6());
|
||||
Assert.assertEquals("Work", location.name);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void googleNavigationQueryOnly() throws Exception {
|
||||
final Location[] results = LocationUriParser.parseLocations("google.navigation:///?q=gleimstr.&mode=w&entry=v");
|
||||
|
||||
Assert.assertEquals(1, results.length);
|
||||
final Location location = results[0];
|
||||
|
||||
Assert.assertEquals(LocationType.ANY, location.type);
|
||||
Assert.assertFalse(location.hasCoord());
|
||||
Assert.assertEquals("gleimstr.", location.name);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void googleNavigationTitle() throws Exception {
|
||||
final Location[] results = LocationUriParser.parseLocations(
|
||||
"google.navigation:///?ll=52.535836,13.401525&title=Zionskirchstraße+7,+10119+Berlin,+Germany&entry=w");
|
||||
|
||||
Assert.assertEquals(1, results.length);
|
||||
final Location location = results[0];
|
||||
|
||||
Assert.assertEquals(LocationType.ADDRESS, location.type);
|
||||
Assert.assertEquals(13401525, location.getLonAs1E6());
|
||||
Assert.assertEquals(52535836, location.getLatAs1E6());
|
||||
Assert.assertEquals("Zionskirchstraße 7, 10119 Berlin, Germany", location.name);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void googleNavigationQueryOnlyMixed() throws Exception {
|
||||
final Location[] results = LocationUriParser.parseLocations(
|
||||
"google.navigation:///?q=52.513064,13.420106000000033(C-Base,+Rungestraße,+Berlin,+Germany)&entry=w");
|
||||
|
||||
Assert.assertEquals(1, results.length);
|
||||
final Location location = results[0];
|
||||
|
||||
Assert.assertEquals(LocationType.ADDRESS, location.type);
|
||||
Assert.assertEquals(13420106, location.getLonAs1E6());
|
||||
Assert.assertEquals(52513064, location.getLatAs1E6());
|
||||
Assert.assertEquals("C-Base, Rungestraße, Berlin, Germany", location.name);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void contacts() throws Exception {
|
||||
final Location[] results = LocationUriParser.parseLocations("geo:0,0?q=Karl-Marx-Allee+84,+Berlin");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue