This commit is contained in:
Naumov Dmitry 2021-01-17 16:54:17 +05:00
parent f1bdb378ea
commit bf5de1a4e2
2 changed files with 9 additions and 5 deletions

View file

@ -333,8 +333,8 @@ public class MapUtils {
});
}
public static String buildGeoUrl(double latitude, double longitude, int zoom) {
return "geo:" + ((float) latitude) + "," + ((float) longitude) + "?z=" + zoom;
public static String buildGeoUrl(String latitude, String longitude, int zoom) {
return "geo:" + latitude + "," + longitude + "?z=" + zoom;
}
// Examples

View file

@ -9,6 +9,7 @@ import androidx.annotation.NonNull;
import androidx.core.text.TextUtilsCompat;
import androidx.core.view.ViewCompat;
import net.osmand.LocationConvert;
import net.osmand.data.LatLon;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
@ -99,10 +100,13 @@ public class ShareMenu extends BaseMenuController {
if (mapActivity == null) {
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 String geoUrl = MapUtils.buildGeoUrl(latLon.getLatitude(), latLon.getLongitude(), zoom);
final String httpUrl = "https://osmand.net/go?lat=" + ((float) latLon.getLatitude())
+ "&lon=" + ((float) latLon.getLongitude()) + "&z=" + zoom;
final String geoUrl = MapUtils.buildGeoUrl(lat, lon, zoom);
final String httpUrl = "https://osmand.net/go?lat=" + lat + "&lon=" + lon + "&z=" + zoom;
StringBuilder sb = new StringBuilder();
if (!Algorithms.isEmpty(title)) {
sb.append(title).append("\n");