Fix #10517
This commit is contained in:
parent
f1bdb378ea
commit
bf5de1a4e2
2 changed files with 9 additions and 5 deletions
|
@ -333,8 +333,8 @@ public class MapUtils {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String buildGeoUrl(double latitude, double longitude, int zoom) {
|
public static String buildGeoUrl(String latitude, String longitude, int zoom) {
|
||||||
return "geo:" + ((float) latitude) + "," + ((float) longitude) + "?z=" + zoom;
|
return "geo:" + latitude + "," + longitude + "?z=" + zoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Examples
|
// Examples
|
||||||
|
|
|
@ -9,6 +9,7 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.core.text.TextUtilsCompat;
|
import androidx.core.text.TextUtilsCompat;
|
||||||
import androidx.core.view.ViewCompat;
|
import androidx.core.view.ViewCompat;
|
||||||
|
|
||||||
|
import net.osmand.LocationConvert;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
@ -99,10 +100,13 @@ public class ShareMenu extends BaseMenuController {
|
||||||
if (mapActivity == null) {
|
if (mapActivity == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
String lat = LocationConvert.convertLatitude(latLon.getLatitude(), LocationConvert.FORMAT_DEGREES, false);
|
||||||
|
String lon = LocationConvert.convertLongitude(latLon.getLongitude(), LocationConvert.FORMAT_DEGREES, false);
|
||||||
|
lat = lat.substring(0, lat.length() - 1);
|
||||||
|
lon = lon.substring(0, lon.length() - 1);
|
||||||
final int zoom = mapActivity.getMapView().getZoom();
|
final int zoom = mapActivity.getMapView().getZoom();
|
||||||
final String geoUrl = MapUtils.buildGeoUrl(latLon.getLatitude(), latLon.getLongitude(), zoom);
|
final String geoUrl = MapUtils.buildGeoUrl(lat, lon, zoom);
|
||||||
final String httpUrl = "https://osmand.net/go?lat=" + ((float) latLon.getLatitude())
|
final String httpUrl = "https://osmand.net/go?lat=" + lat + "&lon=" + lon + "&z=" + zoom;
|
||||||
+ "&lon=" + ((float) latLon.getLongitude()) + "&z=" + zoom;
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
if (!Algorithms.isEmpty(title)) {
|
if (!Algorithms.isEmpty(title)) {
|
||||||
sb.append(title).append("\n");
|
sb.append(title).append("\n");
|
||||||
|
|
Loading…
Reference in a new issue