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/AndroidManifest.xml b/mobile/AndroidManifest.xml index 5fd825d1..d7e54c57 100644 --- a/mobile/AndroidManifest.xml +++ b/mobile/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="19" + android:versionName="0.3.7" > - - Settings Reload IITC Print Version - Clear Cache Toggle fullscreen Get Location local 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); diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java index dff1098f..09c079e7 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java @@ -255,12 +255,6 @@ public class IITC_Mobile extends Activity { this.loadUrl(intel_url); actionBar.setTitle(getString(R.string.menu_map)); return true; - // clear cache - case R.id.cache_clear : - iitc_view.clearHistory(); - iitc_view.clearFormData(); - iitc_view.clearCache(true); - return true; case R.id.toggle_fullscreen : toggleFullscreen(); return true; diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java b/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java index a81efb67..866d1f38 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java @@ -1,10 +1,12 @@ package com.cradle.iitc_mobile; import android.annotation.SuppressLint; +import android.annotation.TargetApi; import android.content.Context; import android.content.SharedPreferences; import android.net.ConnectivityManager; import android.net.NetworkInfo; +import android.os.Build; import android.preference.PreferenceManager; import android.util.AttributeSet; import android.util.Log; @@ -122,11 +124,20 @@ public class IITC_WebView extends WebView { } } + @TargetApi(Build.VERSION_CODES.JELLY_BEAN) private boolean isConnectedToWifi() { ConnectivityManager conMan = (ConnectivityManager) getContext() .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo wifi = conMan.getNetworkInfo(ConnectivityManager.TYPE_WIFI); - return wifi.getState() == NetworkInfo.State.CONNECTED; + // since jelly bean you can mark wifi networks as mobile hotspots + // settings -> data usage -> menu -> mobile hotspots + // ConnectivityManager.isActiveNetworkMeter returns if the currently used wifi-network + // is ticked as mobile hotspot or not. + // --> IITC_WebView.isConnectedToWifi should return 'false' if connected to mobile hotspot + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + return ((wifi.getState() == NetworkInfo.State.CONNECTED) && !conMan.isActiveNetworkMetered()); + } + return (wifi.getState() == NetworkInfo.State.CONNECTED); } public void disableJS(boolean val) { diff --git a/plugins/speech-search.user.js b/plugins/speech-search.user.js new file mode 100644 index 00000000..3b90e8e5 --- /dev/null +++ b/plugins/speech-search.user.js @@ -0,0 +1,50 @@ +// ==UserScript== +// @id iitc-plugin-speech-search +// @name IITC Plugin: Speech Search +// @version 0.0.1.@@DATETIMEVERSION@@ +// @namespace https://github.com/jonatkins/ingress-intel-total-conversion +// @updateURL @@UPDATEURL@@ +// @downloadURL @@DOWNLOADURL@@ +// @description [@@BUILDNAME@@-@@BUILDDATE@@] Allow speech input for location search (webkit only for now - NOT Firefox) +// @include https://www.ingress.com/intel* +// @include http://www.ingress.com/intel* +// @match https://www.ingress.com/intel* +// @match http://www.ingress.com/intel* +// ==/UserScript== + +function wrapper() { +// ensure plugin framework is there, even if iitc is not yet loaded +if (typeof window.plugin !== 'function') window.plugin = function() {}; + + +// PLUGIN START //////////////////////////////////////////////////////// + +// use own namespace for plugin +window.plugin.speechSearch = function() {}; + +window.plugin.speechSearch.setup = function() { + // Give the search input the speech attribute + $("#geosearch").attr("x-webkit-speech", ""); + // Immediately search without further input + $("#geosearch").bind("webkitspeechchange", function() { + $("#geosearch").trigger($.Event("keypress", {keyCode: 13})); + }); +}; + +var setup = window.plugin.speechSearch.setup; + +// PLUGIN END ////////////////////////////////////////////////////////// + +if(window.iitcLoaded && typeof setup === 'function') { + setup(); +} else { + if(window.bootPlugins) + window.bootPlugins.push(setup); + else + window.bootPlugins = [setup]; +} +} // wrapper end +// inject code into site context +var script = document.createElement('script'); +script.appendChild(document.createTextNode('('+ wrapper +')();')); +(document.body || document.head || document.documentElement).appendChild(script);