copy a gmaps location link to clipboard if user location marker is clicked
This commit is contained in:
parent
90a9770e09
commit
30e1a26af0
@ -174,8 +174,6 @@ public class IITC_Mobile extends Activity {
|
|||||||
if (Intent.ACTION_VIEW.equals(action)) {
|
if (Intent.ACTION_VIEW.equals(action)) {
|
||||||
Uri uri = intent.getData();
|
Uri uri = intent.getData();
|
||||||
String url = uri.toString();
|
String url = uri.toString();
|
||||||
if (intent.getScheme().equals("http"))
|
|
||||||
url = url.replace("http://", "https://");
|
|
||||||
Log.d("iitcm", "intent received url: " + url);
|
Log.d("iitcm", "intent received url: " + url);
|
||||||
if (url.contains("ingress.com")) {
|
if (url.contains("ingress.com")) {
|
||||||
Log.d("iitcm", "loading url...");
|
Log.d("iitcm", "loading url...");
|
||||||
|
@ -37,7 +37,6 @@ public class IITC_WebView extends WebView {
|
|||||||
+ "/databases/");
|
+ "/databases/");
|
||||||
settings.setAppCachePath(this.getContext().getCacheDir()
|
settings.setAppCachePath(this.getContext().getCacheDir()
|
||||||
.getAbsolutePath());
|
.getAbsolutePath());
|
||||||
// use cache if on mobile network...saves traffic
|
|
||||||
this.js_interface = new IITC_JSInterface(c);
|
this.js_interface = new IITC_JSInterface(c);
|
||||||
this.addJavascriptInterface(js_interface, "android");
|
this.addJavascriptInterface(js_interface, "android");
|
||||||
|
|
||||||
@ -132,6 +131,7 @@ public class IITC_WebView extends WebView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateCaching() {
|
public void updateCaching() {
|
||||||
|
// use cache if on mobile network...saves traffic
|
||||||
if (!this.isConnectedToWifi()) {
|
if (!this.isConnectedToWifi()) {
|
||||||
Log.d("iitcm", "not connected to wifi...load tiles from cache");
|
Log.d("iitcm", "not connected to wifi...load tiles from cache");
|
||||||
settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
|
settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
|
||||||
|
@ -31,10 +31,21 @@ window.plugin.userLocation.setup = function() {
|
|||||||
iconRetinaUrl: iconRetImage
|
iconRetinaUrl: iconRetImage
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
var cssClass = PLAYER.team === 'ALIENS' ? 'enl' : 'res';
|
||||||
|
var title = '<span class="nickname '+ cssClass+'" style="font-weight:bold;">' + PLAYER.nickname + '</span>\'s location';
|
||||||
|
|
||||||
var marker = L.marker(window.map.getCenter(), {
|
var marker = L.marker(window.map.getCenter(), {
|
||||||
title: "User Location",
|
title: title,
|
||||||
icon: new plugin.userLocation.icon()
|
icon: new plugin.userLocation.icon()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// copy location to android clipboard on marker click
|
||||||
|
marker.on('click', function(e) {
|
||||||
|
window.console.log('marker location');
|
||||||
|
var ll = e.target.getLatLng();
|
||||||
|
window.androidCopy('https://maps.google.com/?q='+ll.lat+','+ll.lng+'%20('+PLAYER.nickname+')');
|
||||||
|
});
|
||||||
|
|
||||||
plugin.userLocation.marker = marker;
|
plugin.userLocation.marker = marker;
|
||||||
marker.addTo(window.map);
|
marker.addTo(window.map);
|
||||||
// jQueryUI doesn’t automatically notice the new markers
|
// jQueryUI doesn’t automatically notice the new markers
|
||||||
|
Loading…
x
Reference in New Issue
Block a user