[iitcm] push layer changes to Android instead of relying on MapSettings to poll them

This commit is contained in:
fkloft
2015-10-21 00:09:21 +02:00
parent 4b71798a7c
commit 3f0d924b6a
2 changed files with 13 additions and 7 deletions

View File

@ -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);
}
}

View File

@ -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()");
}
}
}