Merge branch 'master' of https://github.com/osmandapp/Osmand
This commit is contained in:
commit
411844510d
7 changed files with 127 additions and 162 deletions
|
@ -1,107 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="JAVA_MODULE" version="4">
|
|
||||||
<component name="EclipseModuleManager">
|
|
||||||
<libelement value="jar://$MODULE_DIR$/libs/bsh-core-2.0b4.jar!/" />
|
|
||||||
<libelement value="jar://$MODULE_DIR$/libs/bzip2-20090327.jar!/" />
|
|
||||||
<libelement value="jar://$MODULE_DIR$/libs/commons-logging-1.1.1.jar!/" />
|
|
||||||
<libelement value="jar://$MODULE_DIR$/libs/json-20090211.jar!/" />
|
|
||||||
<libelement value="jar://$MODULE_DIR$/libs/junidecode-0.1.jar!/" />
|
|
||||||
<libelement value="jar://$MODULE_DIR$/libs/kxml2-2.3.0.jar!/" />
|
|
||||||
<libelement value="jar://$MODULE_DIR$/libs/tuprolog.jar!/" />
|
|
||||||
<libelement value="jar://$MODULE_DIR$/libs/icu4j-49_1.jar!/" />
|
|
||||||
<libelement value="jar://$MODULE_DIR$/libs/gnu-trove-osmand.jar!/" />
|
|
||||||
<src_description expected_position="0">
|
|
||||||
<src_folder value="file://$MODULE_DIR$/src" expected_position="0" />
|
|
||||||
</src_description>
|
|
||||||
</component>
|
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
|
||||||
<output url="file://$MODULE_DIR$/bin" />
|
|
||||||
<exclude-output />
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
<orderEntry type="jdk" jdkName="1.7" jdkType="JavaSDK" />
|
|
||||||
<orderEntry type="module-library">
|
|
||||||
<library name="bsh-core-2.0b4.jar">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MODULE_DIR$/libs/bsh-core-2.0b4.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES />
|
|
||||||
</library>
|
|
||||||
</orderEntry>
|
|
||||||
<orderEntry type="module-library">
|
|
||||||
<library name="bzip2-20090327.jar">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MODULE_DIR$/libs/bzip2-20090327.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES />
|
|
||||||
</library>
|
|
||||||
</orderEntry>
|
|
||||||
<orderEntry type="module-library">
|
|
||||||
<library name="commons-logging-1.1.1.jar">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MODULE_DIR$/libs/commons-logging-1.1.1.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES />
|
|
||||||
</library>
|
|
||||||
</orderEntry>
|
|
||||||
<orderEntry type="module-library">
|
|
||||||
<library name="json-20090211.jar">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MODULE_DIR$/libs/json-20090211.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES />
|
|
||||||
</library>
|
|
||||||
</orderEntry>
|
|
||||||
<orderEntry type="module-library">
|
|
||||||
<library name="junidecode-0.1.jar">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MODULE_DIR$/libs/junidecode-0.1.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES />
|
|
||||||
</library>
|
|
||||||
</orderEntry>
|
|
||||||
<orderEntry type="module-library">
|
|
||||||
<library name="kxml2-2.3.0.jar">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MODULE_DIR$/libs/kxml2-2.3.0.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES />
|
|
||||||
</library>
|
|
||||||
</orderEntry>
|
|
||||||
<orderEntry type="module-library">
|
|
||||||
<library name="tuprolog.jar">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MODULE_DIR$/libs/tuprolog.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES />
|
|
||||||
</library>
|
|
||||||
</orderEntry>
|
|
||||||
<orderEntry type="module-library">
|
|
||||||
<library name="icu4j-49_1.jar">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MODULE_DIR$/libs/icu4j-49_1.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES />
|
|
||||||
</library>
|
|
||||||
</orderEntry>
|
|
||||||
<orderEntry type="module-library">
|
|
||||||
<library name="gnu-trove-osmand.jar">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MODULE_DIR$/libs/gnu-trove-osmand.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES />
|
|
||||||
</library>
|
|
||||||
</orderEntry>
|
|
||||||
</component>
|
|
||||||
</module>
|
|
|
@ -1,15 +1,20 @@
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
java {
|
||||||
|
srcDirs = [
|
||||||
|
"src"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is Android-specific
|
||||||
jar {
|
jar {
|
||||||
sourceSets {
|
exclude "**/PlatformUtil.*"
|
||||||
main {
|
|
||||||
java {
|
|
||||||
srcDirs = ["src"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: "libs", include: ["*.jar"])
|
compile fileTree(dir: "libs", include: ["*.jar"])
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.net.URLDecoder;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -25,12 +26,14 @@ public class GeoPointParserUtil {
|
||||||
url = "geo:" + ilat + "," + ilon;
|
url = "geo:" + ilat + "," + ilon;
|
||||||
System.out.println("url: " + url);
|
System.out.println("url: " + url);
|
||||||
GeoParsedPoint actual = GeoPointParserUtil.parse(url);
|
GeoParsedPoint actual = GeoPointParserUtil.parse(url);
|
||||||
|
assertUrlEquals(url, actual.getGeoUriString());
|
||||||
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon));
|
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon));
|
||||||
|
|
||||||
// geo:34.99393,-106.61568
|
// geo:34.99393,-106.61568
|
||||||
url = "geo:" + dlat + "," + dlon;
|
url = "geo:" + dlat + "," + dlon;
|
||||||
System.out.println("url: " + url);
|
System.out.println("url: " + url);
|
||||||
actual = GeoPointParserUtil.parse(url);
|
actual = GeoPointParserUtil.parse(url);
|
||||||
|
assertUrlEquals(url, actual.getGeoUriString());
|
||||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon));
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon));
|
||||||
|
|
||||||
// geo:34.99393,-106.61568?z=11
|
// geo:34.99393,-106.61568?z=11
|
||||||
|
@ -38,6 +41,7 @@ public class GeoPointParserUtil {
|
||||||
url = "geo:" + dlat + "," + dlon + "?z=" + z;
|
url = "geo:" + dlat + "," + dlon + "?z=" + z;
|
||||||
System.out.println("url: " + url);
|
System.out.println("url: " + url);
|
||||||
actual = GeoPointParserUtil.parse(url);
|
actual = GeoPointParserUtil.parse(url);
|
||||||
|
assertUrlEquals(url, actual.getGeoUriString());
|
||||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
||||||
|
|
||||||
// geo:34.99393,-106.61568 (Treasure Island)
|
// geo:34.99393,-106.61568 (Treasure Island)
|
||||||
|
@ -60,16 +64,23 @@ public class GeoPointParserUtil {
|
||||||
actual = GeoPointParserUtil.parse(url);
|
actual = GeoPointParserUtil.parse(url);
|
||||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z, name));
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z, name));
|
||||||
|
|
||||||
|
// geo:34.99393,-106.61568?q=34.99393,-106.61568(Treasure+Island)
|
||||||
|
z = GeoParsedPoint.NO_ZOOM;
|
||||||
|
url = "geo:" + dlat + "," + dlon + "?q=" + dlat + "," + dlon + "(" + URLEncoder.encode(name) + ")";
|
||||||
|
System.out.println("url: " + url);
|
||||||
|
actual = GeoPointParserUtil.parse(url);
|
||||||
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z, name));
|
||||||
|
assertUrlEquals(url, actual.getGeoUriString());
|
||||||
|
|
||||||
// 0,0?q=34,-106(Treasure Island)
|
// 0,0?q=34,-106(Treasure Island)
|
||||||
z = GeoParsedPoint.NO_ZOOM;
|
z = GeoParsedPoint.NO_ZOOM;
|
||||||
url = "geo:0,0?q=" + ilat + "," + ilon + " (" + name + ")";
|
url = "geo:0,0?q=" + ilat + "," + ilon + "(" + name + ")";
|
||||||
System.out.println("url: " + url);
|
|
||||||
actual = GeoPointParserUtil.parse(url);
|
actual = GeoPointParserUtil.parse(url);
|
||||||
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z, name));
|
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z, name));
|
||||||
|
|
||||||
// 0,0?q=34.99393,-106.61568(Treasure Island)
|
// 0,0?q=34.99393,-106.61568(Treasure Island)
|
||||||
z = GeoParsedPoint.NO_ZOOM;
|
z = GeoParsedPoint.NO_ZOOM;
|
||||||
url = "geo:0,0?q=" + dlat + "," + dlon + " (" + name + ")";
|
url = "geo:0,0?q=" + dlat + "," + dlon + "(" + name + ")";
|
||||||
System.out.println("url: " + url);
|
System.out.println("url: " + url);
|
||||||
actual = GeoPointParserUtil.parse(url);
|
actual = GeoPointParserUtil.parse(url);
|
||||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z, name));
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z, name));
|
||||||
|
@ -91,11 +102,27 @@ public class GeoPointParserUtil {
|
||||||
// google calendar
|
// google calendar
|
||||||
// geo:0,0?q=760 West Genesee Street Syracuse NY 13204
|
// geo:0,0?q=760 West Genesee Street Syracuse NY 13204
|
||||||
String qstr = "760 West Genesee Street Syracuse NY 13204";
|
String qstr = "760 West Genesee Street Syracuse NY 13204";
|
||||||
|
url = "geo:0,0?q=" + URLEncoder.encode(qstr);
|
||||||
|
System.out.println("url: " + url);
|
||||||
|
actual = GeoPointParserUtil.parse(url);
|
||||||
|
assertGeoPoint(actual, new GeoParsedPoint(qstr));
|
||||||
|
assertUrlEquals(url, actual.getGeoUriString());
|
||||||
|
|
||||||
|
// geo:0,0?q=760 West Genesee Street Syracuse NY 13204
|
||||||
|
qstr = "760 West Genesee Street Syracuse NY 13204";
|
||||||
url = "geo:0,0?q=" + qstr;
|
url = "geo:0,0?q=" + qstr;
|
||||||
System.out.println("url: " + url);
|
System.out.println("url: " + url);
|
||||||
actual = GeoPointParserUtil.parse(url);
|
actual = GeoPointParserUtil.parse(url);
|
||||||
assertGeoPoint(actual, new GeoParsedPoint(qstr));
|
assertGeoPoint(actual, new GeoParsedPoint(qstr));
|
||||||
|
|
||||||
|
// geo:0,0?z=11&q=1600+Amphitheatre+Parkway,+CA
|
||||||
|
qstr = "1600 Amphitheatre Parkway, CA";
|
||||||
|
url = "geo:0,0?q=" + URLEncoder.encode(qstr);
|
||||||
|
System.out.println("url: " + url);
|
||||||
|
actual = GeoPointParserUtil.parse(url);
|
||||||
|
assertGeoPoint(actual, new GeoParsedPoint(qstr));
|
||||||
|
assertUrlEquals(url, actual.getGeoUriString());
|
||||||
|
|
||||||
// geo:0,0?z=11&q=1600+Amphitheatre+Parkway,+CA
|
// geo:0,0?z=11&q=1600+Amphitheatre+Parkway,+CA
|
||||||
qstr = "1600 Amphitheatre Parkway, CA";
|
qstr = "1600 Amphitheatre Parkway, CA";
|
||||||
url = "geo:0,0?z=11&q=" + URLEncoder.encode(qstr);
|
url = "geo:0,0?z=11&q=" + URLEncoder.encode(qstr);
|
||||||
|
@ -398,7 +425,6 @@ public class GeoPointParserUtil {
|
||||||
private static boolean areCloseEnough(double a, double b, long howClose) {
|
private static boolean areCloseEnough(double a, double b, long howClose) {
|
||||||
long aRounded = (long) Math.round(a * Math.pow(10, howClose));
|
long aRounded = (long) Math.round(a * Math.pow(10, howClose));
|
||||||
long bRounded = (long) Math.round(b * Math.pow(10, howClose));
|
long bRounded = (long) Math.round(b * Math.pow(10, howClose));
|
||||||
System.out.println("areCloseEnough: " + aRounded + ", " + bRounded);
|
|
||||||
return aRounded == bRounded;
|
return aRounded == bRounded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,11 +435,11 @@ public class GeoPointParserUtil {
|
||||||
} else {
|
} else {
|
||||||
double aLat = actual.getLatitude(), eLat = expected.getLatitude(), aLon = actual.getLongitude(), eLon = expected.getLongitude();
|
double aLat = actual.getLatitude(), eLat = expected.getLatitude(), aLon = actual.getLongitude(), eLon = expected.getLongitude();
|
||||||
int aZoom = actual.getZoom(), eZoom = expected.getZoom();
|
int aZoom = actual.getZoom(), eZoom = expected.getZoom();
|
||||||
String aName = actual.getName(), eName = expected.getName();
|
String aLabel = actual.getLabel(), eLabel = expected.getLabel();
|
||||||
if (eName != null) {
|
if (eLabel != null) {
|
||||||
if (!aName.equals(eName)) {
|
if (!aLabel.equals(eLabel)) {
|
||||||
throw new RuntimeException("Point name\\capture is not equal; actual=" + aName + ", expected="
|
throw new RuntimeException("Point label is not equal; actual="
|
||||||
+ eName);
|
+ aLabel + ", expected=" + eLabel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!areCloseEnough(eLat, aLat, 5)) {
|
if (!areCloseEnough(eLat, aLat, 5)) {
|
||||||
|
@ -436,11 +462,11 @@ public class GeoPointParserUtil {
|
||||||
} else {
|
} else {
|
||||||
double aLat = actual.getLatitude(), eLat = expected.getLatitude(), aLon = actual.getLongitude(), eLon = expected.getLongitude();
|
double aLat = actual.getLatitude(), eLat = expected.getLatitude(), aLon = actual.getLongitude(), eLon = expected.getLongitude();
|
||||||
int aZoom = actual.getZoom(), eZoom = expected.getZoom();
|
int aZoom = actual.getZoom(), eZoom = expected.getZoom();
|
||||||
String aName = actual.getName(), eName = expected.getName();
|
String aLabel = actual.getLabel(), eLabel = expected.getLabel();
|
||||||
if (eName != null) {
|
if (eLabel != null) {
|
||||||
if (!aName.equals(eName)) {
|
if (!aLabel.equals(eLabel)) {
|
||||||
throw new RuntimeException("Point name\\capture is not equal; actual=" + aName + ", expected="
|
throw new RuntimeException("Point label is not equal; actual="
|
||||||
+ eName);
|
+ aLabel + ", expected=" + eLabel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (((int)eLat) != ((int)aLat)) {
|
if (((int)eLat) != ((int)aLat)) {
|
||||||
|
@ -456,6 +482,11 @@ public class GeoPointParserUtil {
|
||||||
System.out.println("Passed!");
|
System.out.println("Passed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void assertUrlEquals(String actual, String expected) {
|
||||||
|
if (actual == null || !actual.equals(expected))
|
||||||
|
throw new RuntimeException("URLs not equal; actual=" + actual + ", expected=" + expected);
|
||||||
|
}
|
||||||
|
|
||||||
private static String getQueryParameter(final String param, URI uri) {
|
private static String getQueryParameter(final String param, URI uri) {
|
||||||
final String query = uri.getQuery();
|
final String query = uri.getQuery();
|
||||||
String value = null;
|
String value = null;
|
||||||
|
@ -474,8 +505,7 @@ public class GeoPointParserUtil {
|
||||||
/**
|
/**
|
||||||
* Parses geo and map intents:
|
* Parses geo and map intents:
|
||||||
*
|
*
|
||||||
* @param uri
|
* @param uriString The URI as a String
|
||||||
* The URI object
|
|
||||||
* @return {@link GeoParsedPoint}
|
* @return {@link GeoParsedPoint}
|
||||||
*/
|
*/
|
||||||
public static GeoParsedPoint parse(final String uriString) {
|
public static GeoParsedPoint parse(final String uriString) {
|
||||||
|
@ -781,10 +811,10 @@ public class GeoPointParserUtil {
|
||||||
public static class GeoParsedPoint {
|
public static class GeoParsedPoint {
|
||||||
private static final int NO_ZOOM = -1;
|
private static final int NO_ZOOM = -1;
|
||||||
|
|
||||||
private double lat;
|
private double lat = 0;
|
||||||
private double lon;
|
private double lon = 0;
|
||||||
private int zoom = NO_ZOOM;
|
private int zoom = NO_ZOOM;
|
||||||
private String name;
|
private String label;
|
||||||
private String query;
|
private String query;
|
||||||
private boolean geoPoint;
|
private boolean geoPoint;
|
||||||
private boolean geoAddress;
|
private boolean geoAddress;
|
||||||
|
@ -796,10 +826,10 @@ public class GeoPointParserUtil {
|
||||||
this.geoPoint = true;
|
this.geoPoint = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GeoParsedPoint(double lat, double lon, String name) {
|
public GeoParsedPoint(double lat, double lon, String label) {
|
||||||
this(lat, lon);
|
this(lat, lon);
|
||||||
if (name != null)
|
if (label != null)
|
||||||
this.name = name.replaceAll("\\+", " ");
|
this.label = label.replaceAll("\\+", " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
public GeoParsedPoint(double lat, double lon, int zoom) {
|
public GeoParsedPoint(double lat, double lon, int zoom) {
|
||||||
|
@ -807,8 +837,8 @@ public class GeoPointParserUtil {
|
||||||
this.zoom = zoom;
|
this.zoom = zoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GeoParsedPoint(double lat, double lon, int zoom, String name) {
|
public GeoParsedPoint(double lat, double lon, int zoom, String label) {
|
||||||
this(lat, lon, name);
|
this(lat, lon, label);
|
||||||
this.zoom = zoom;
|
this.zoom = zoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -840,8 +870,8 @@ public class GeoPointParserUtil {
|
||||||
return zoom;
|
return zoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getLabel() {
|
||||||
return name;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getQuery() {
|
public String getQuery() {
|
||||||
|
@ -852,10 +882,59 @@ public class GeoPointParserUtil {
|
||||||
return geoPoint;
|
return geoPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String formatDouble(double d) {
|
||||||
|
if(d == (long) d)
|
||||||
|
return String.format(Locale.ENGLISH, "%d", (long)d);
|
||||||
|
else
|
||||||
|
return String.format("%s", d);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isGeoAddress() {
|
public boolean isGeoAddress() {
|
||||||
return geoAddress;
|
return geoAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a URI string according to https://tools.ietf.org/html/rfc5870 and
|
||||||
|
* https://developer.android.com/guide/components/intents-common.html#Maps
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getGeoUriString() {
|
||||||
|
String uriString;
|
||||||
|
if (isGeoPoint()) {
|
||||||
|
String latlon = formatDouble(lat) + "," + formatDouble(lon);
|
||||||
|
uriString = "geo:" + latlon;
|
||||||
|
LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
|
||||||
|
if (zoom != NO_ZOOM)
|
||||||
|
map.put("z", String.valueOf(zoom));
|
||||||
|
if (query != null)
|
||||||
|
map.put("q", URLEncoder.encode(query));
|
||||||
|
if (label != null)
|
||||||
|
if (query == null)
|
||||||
|
map.put("q", latlon + "(" + URLEncoder.encode(label) + ")");
|
||||||
|
if (map.size() > 0)
|
||||||
|
uriString += "?";
|
||||||
|
int i = 0;
|
||||||
|
for (String key : map.keySet()) {
|
||||||
|
if (i > 0)
|
||||||
|
uriString += "&";
|
||||||
|
uriString += key + "=" + map.get(key);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return uriString;
|
||||||
|
}
|
||||||
|
if (isGeoAddress()) {
|
||||||
|
uriString = "geo:0,0";
|
||||||
|
if (query != null) {
|
||||||
|
uriString += "?";
|
||||||
|
if (zoom != NO_ZOOM)
|
||||||
|
uriString += "z=" + zoom + "&";
|
||||||
|
uriString += "q=" + URLEncoder.encode(query);
|
||||||
|
}
|
||||||
|
return uriString;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return isGeoPoint() ? "GeoParsedPoint [lat=" + lat + ", lon=" + lon + ", zoom=" + zoom + ", name=" + name
|
return isGeoPoint() ? "GeoParsedPoint [lat=" + lat + ", lon=" + lon + ", zoom=" + zoom + ", name=" + name
|
||||||
|
|
23
OsmAnd/build.gradle
Executable file → Normal file
23
OsmAnd/build.gradle
Executable file → Normal file
|
@ -73,30 +73,18 @@ android {
|
||||||
jni.srcDirs = []
|
jni.srcDirs = []
|
||||||
jniLibs.srcDirs = ["libs"]
|
jniLibs.srcDirs = ["libs"]
|
||||||
aidl.srcDirs = ["src"]
|
aidl.srcDirs = ["src"]
|
||||||
java.srcDirs = [
|
java.srcDirs = ["src"]
|
||||||
"src",
|
resources.srcDirs = ["src"]
|
||||||
fileTree(dir: "../OsmAnd-java/src", exclude: "**/PlatformUtil.java")
|
|
||||||
]
|
|
||||||
resources.srcDirs = [
|
|
||||||
"src"
|
|
||||||
]
|
|
||||||
renderscript.srcDirs = ["src"]
|
renderscript.srcDirs = ["src"]
|
||||||
res.srcDirs = [
|
res.srcDirs = ["res"]
|
||||||
'res'
|
assets.srcDirs = ["assets"]
|
||||||
|
|
||||||
]
|
|
||||||
assets.srcDirs = [
|
|
||||||
'assets'
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
free {
|
free {
|
||||||
manifest.srcFile "AndroidManifest-free.xml"
|
manifest.srcFile "AndroidManifest-free.xml"
|
||||||
}
|
}
|
||||||
|
|
||||||
legacy {
|
legacy {
|
||||||
jniLibs.srcDirs = [
|
jniLibs.srcDirs = ["libgnustl"]
|
||||||
"libgnustl"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,6 +299,7 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
compile project(":OsmAnd-java")
|
||||||
compile fileTree(
|
compile fileTree(
|
||||||
dir: "libs",
|
dir: "libs",
|
||||||
include: ["*.jar"],
|
include: ["*.jar"],
|
||||||
|
|
|
@ -210,8 +210,8 @@ public class GeoIntentActivity extends OsmandListActivity {
|
||||||
private MyService extract(final Uri uri) {
|
private MyService extract(final Uri uri) {
|
||||||
GeoPointParserUtil.GeoParsedPoint p = GeoPointParserUtil.parse(uri.toString());
|
GeoPointParserUtil.GeoParsedPoint p = GeoPointParserUtil.parse(uri.toString());
|
||||||
if (p.isGeoPoint()) {
|
if (p.isGeoPoint()) {
|
||||||
if (p.getName() != null) {
|
if (p.getLabel() != null) {
|
||||||
return new GeoPointSearch(p.getLatitude(), p.getLongitude(), p.getName(), p.getZoom());
|
return new GeoPointSearch(p.getLatitude(), p.getLongitude(), p.getLabel(), p.getZoom());
|
||||||
}
|
}
|
||||||
return new GeoPointSearch(p.getLatitude(), p.getLongitude(), p.getZoom());
|
return new GeoPointSearch(p.getLatitude(), p.getLongitude(), p.getZoom());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
include ':OsmAnd'
|
include ':OsmAnd'
|
||||||
|
include ':OsmAnd-java'
|
||||||
|
|
Loading…
Reference in a new issue