From 3f0d924b6a79f1588bec9ef35d98f6aba901e2c2 Mon Sep 17 00:00:00 2001 From: fkloft Date: Wed, 21 Oct 2015 00:09:21 +0200 Subject: [PATCH] [iitcm] push layer changes to Android instead of relying on MapSettings to poll them --- code/boot.js | 13 +++++++++++++ .../com/cradle/iitc_mobile/IITC_MapSettings.java | 7 ------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/code/boot.js b/code/boot.js index 328855d0..d37cdb3b 100644 --- a/code/boot.js +++ b/code/boot.js @@ -561,6 +561,19 @@ window.setupLayerChooserApi = function() { } return true; + }; + + var _update = window.layerChooser._update; + window.layerChooser._update = function() { + // update layer menu in IITCm + try { + if(typeof android != 'undefined') + window.layerChooser.getLayers(); + } catch(e) { + console.error(e); + } + // call through + return _update.apply(this, arguments); } } diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_MapSettings.java b/mobile/src/com/cradle/iitc_mobile/IITC_MapSettings.java index 7cd80677..f101d82d 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_MapSettings.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_MapSettings.java @@ -144,7 +144,6 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList public void onBootFinished() { mLoading = false; - updateLayers(); } @Override @@ -279,10 +278,4 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList } mOverlayLayers.notifyDataSetChanged(); } - - public void updateLayers() { - if (!mLoading) { - mIitc.getWebView().loadUrl("javascript: window.layerChooser.getLayers()"); - } - } }