add bing maps link to "map links" dialog

the encoded_name no longer includes the space/brackets - so these are now added in the java app - which makes more sense anyway
unknown names (shouldn't happen) are now named 'unknown' rather than not specified
This commit is contained in:
Jon Atkins 2013-05-14 22:35:12 +01:00
parent 11e9663e60
commit 73487d7e50
2 changed files with 7 additions and 5 deletions

View File

@ -154,20 +154,22 @@ window.rangeLinkClick = function() {
}
window.showPortalPosLinks = function(lat, lng, name) {
var encoded_name = '';
var encoded_name = 'undefined';
if(name !== undefined) {
encoded_name = encodeURIComponent(' (' + name + ')');
encoded_name = encodeURIComponent(name);
}
if (typeof android !== 'undefined' && android && android.intentPosLink) {
android.intentPosLink(lat, lng, encoded_name);
} else {
var qrcode = '<div id="qrcode"></div>';
var script = '<script>$(\'#qrcode\').qrcode({text:\'GEO:'+lat+','+lng+'\'});</script>';
var gmaps = '<a href="https://maps.google.com/?q='+lat+','+lng+encoded_name+'">Google Maps</a>';
var gmaps = '<a href="https://maps.google.com/?q='+lat+','+lng+'%20('+encoded_name+')">Google Maps</a>';
var bingmaps = '<a href="http://www.bing.com/maps/?v=2&cp='+lat+'~'+lng+'&lvl=16&sp=Point.'+lat+'_'+lng+'_'+encoded_name+'___">Bing Maps</a>';
var osm = '<a href="http://www.openstreetmap.org/?mlat='+lat+'&mlon='+lng+'&zoom=16">OpenStreetMap</a>';
var latLng = '<span>&lt;' + lat + ',' + lng +'&gt;</span>';
dialog({
html: '<div style="text-align: center;">' + qrcode + script + gmaps + '; ' + osm + '<br />' + latLng + '</div>',
html: '<div style="text-align: center;">' + qrcode + script + gmaps + '; ' + bingmaps + '; ' + osm + '<br />' + latLng + '</div>',
title: name,
id: 'poslinks'
});

View File

@ -23,7 +23,7 @@ public class IITC_JSInterface {
@JavascriptInterface
public void intentPosLink(String lat, String lng, String portal_name) {
String uri = "geo:" + lat + "," + lng + "?q=" + lat + "," + lng
+ portal_name;
+ "%20(" + portal_name + ")";
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse(uri));
context.startActivity(intent);