Fix mapillary widget setup. Restore photo viewer after device rotated.

This commit is contained in:
Alexey Kulish 2017-05-08 13:01:36 +03:00
parent 1ee64f77f7
commit 18c4ee42c1
2 changed files with 11 additions and 1 deletions

View file

@ -18,6 +18,7 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.mapillary.MapillaryLayer;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.util.Algorithms;
public class WebImageMenu {
@ -30,6 +31,9 @@ public class WebImageMenu {
private static final String KEY_WEB_IMAGE_MENU_TITLE = "key_web_image_menu_title";
private static final String KEY_WEB_IMAGE_MENU_DESCRIPTION = "key_web_image_menu_description";
private static final String MAPILLARY_VIEWER_URL_TEMPLATE =
"https://osmand.net/api/mapillary/photo-viewer.php?photo_id=";
private WebImageType type;
private String viewerUrl;
private LatLon latLon;
@ -212,10 +216,15 @@ public class WebImageMenu {
}
@JavascriptInterface
public void onNodeChanged(double latitude, double longitude, double ca) {
public void onNodeChanged(double latitude, double longitude, double ca, String key) {
LatLon latLon = null;
if (!Double.isNaN(latitude) && !Double.isNaN(longitude)) {
latLon = new LatLon(latitude, longitude);
WebImageMenu.this.latLon = latLon;
WebImageMenu.this.ca = ca;
if (!Algorithms.isEmpty(key)) {
WebImageMenu.this.viewerUrl = MAPILLARY_VIEWER_URL_TEMPLATE + key;
}
}
setImageLocation(latLon, ca, false);
}

View file

@ -258,6 +258,7 @@ public class MapillaryPlugin extends OsmandPlugin {
dismiss();
}
});
showWidget(showWidget);
return view;
}