Pass title from JavaScript

This commit is contained in:
fkloft 2013-07-26 23:29:32 +02:00
parent 8c947adc59
commit fa4d4c64f7
3 changed files with 6 additions and 9 deletions

View File

@ -176,7 +176,7 @@ window.showPortalPosLinks = function(lat, lng, name) {
} }
if (typeof android !== 'undefined' && android && android.intentPosLink) { if (typeof android !== 'undefined' && android && android.intentPosLink) {
android.intentPosLink(lat, lng, map.getZoom(), name); android.intentPosLink(lat, lng, map.getZoom(), name, true);
} else { } else {
var qrcode = '<div id="qrcode"></div>'; var qrcode = '<div id="qrcode"></div>';
var script = '<script>$(\'#qrcode\').qrcode({text:\'GEO:'+lat+','+lng+'\'});</script>'; var script = '<script>$(\'#qrcode\').qrcode({text:\'GEO:'+lat+','+lng+'\'});</script>';
@ -205,7 +205,7 @@ window.androidPermalink = function() {
return true; // i.e. execute other actions return true; // i.e. execute other actions
var center = map.getCenter(); var center = map.getCenter();
android.intentPosLink(center.lat, center.lng, map.getZoom(), null); android.intentPosLink(center.lat, center.lng, map.getZoom(), "Intel Map", false);
return false; return false;
} }

View File

@ -38,12 +38,13 @@ public class IITC_JSInterface {
// open dialog to send geo intent for navigation apps like gmaps or waze etc... // open dialog to send geo intent for navigation apps like gmaps or waze etc...
@JavascriptInterface @JavascriptInterface
public void intentPosLink(double lat, double lng, int zoom, String portalName) { public void intentPosLink(double lat, double lng, int zoom, String title, boolean isPortal) {
Intent intent = new Intent(context, ShareActivity.class); Intent intent = new Intent(context, ShareActivity.class);
intent.putExtra("lat", lat); intent.putExtra("lat", lat);
intent.putExtra("lng", lng); intent.putExtra("lng", lng);
intent.putExtra("zoom", zoom); intent.putExtra("zoom", zoom);
intent.putExtra("title", portalName); intent.putExtra("title", title);
intent.putExtra("isPortal", isPortal);
context.startActivity(intent); context.startActivity(intent);
} }

View File

@ -63,11 +63,7 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
mTitle = intent.getStringExtra("title"); mTitle = intent.getStringExtra("title");
mLl = intent.getDoubleExtra("lat", 0) + "," + intent.getDoubleExtra("lng", 0); mLl = intent.getDoubleExtra("lat", 0) + "," + intent.getDoubleExtra("lng", 0);
mZoom = intent.getIntExtra("zoom", 0); mZoom = intent.getIntExtra("zoom", 0);
mIsPortal = intent.getBooleanExtra("isPortal", false);
if (mTitle == null) {
mTitle = "Intel Map";
mIsPortal = false;
}
final ActionBar actionBar = getActionBar(); final ActionBar actionBar = getActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);