From 73487d7e509ed53404506b1ee145511078cd95c2 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Tue, 14 May 2013 22:35:12 +0100 Subject: [PATCH] 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 --- code/utils_misc.js | 10 ++++++---- .../src/com/cradle/iitc_mobile/IITC_JSInterface.java | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/code/utils_misc.js b/code/utils_misc.js index 328b3d26..657b7f97 100644 --- a/code/utils_misc.js +++ b/code/utils_misc.js @@ -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 = '
'; var script = ''; - var gmaps = 'Google Maps'; + var gmaps = 'Google Maps'; + var bingmaps = 'Bing Maps'; var osm = 'OpenStreetMap'; var latLng = '<' + lat + ',' + lng +'>'; dialog({ - html: '
' + qrcode + script + gmaps + '; ' + osm + '
' + latLng + '
', + html: '
' + qrcode + script + gmaps + '; ' + bingmaps + '; ' + osm + '
' + latLng + '
', title: name, id: 'poslinks' }); diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java b/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java index 71358af9..a5c2be26 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java @@ -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);