Merge branch 'master' into android_login
This commit is contained in:
commit
db42329234
@ -154,20 +154,22 @@ window.rangeLinkClick = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
window.showPortalPosLinks = function(lat, lng, name) {
|
window.showPortalPosLinks = function(lat, lng, name) {
|
||||||
var encoded_name = '';
|
var encoded_name = 'undefined';
|
||||||
if(name !== undefined) {
|
if(name !== undefined) {
|
||||||
encoded_name = encodeURIComponent(' (' + name + ')');
|
encoded_name = encodeURIComponent(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof android !== 'undefined' && android && android.intentPosLink) {
|
if (typeof android !== 'undefined' && android && android.intentPosLink) {
|
||||||
android.intentPosLink(lat, lng, encoded_name);
|
android.intentPosLink(lat, lng, encoded_name);
|
||||||
} 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>';
|
||||||
var gmaps = '<a href="https://maps.google.com/?q='+lat+','+lng+encoded_name+'">Google Maps</a>';
|
var gmaps = '<a href="https://maps.google.com/?q='+lat+','+lng+'%20('+encoded_name+')">Google Maps</a>';
|
||||||
|
var bingmaps = '<a href="http://www.bing.com/maps/?v=2&cp='+lat+'~'+lng+'&lvl=16&sp=Point.'+lat+'_'+lng+'_'+encoded_name+'___">Bing Maps</a>';
|
||||||
var osm = '<a href="http://www.openstreetmap.org/?mlat='+lat+'&mlon='+lng+'&zoom=16">OpenStreetMap</a>';
|
var osm = '<a href="http://www.openstreetmap.org/?mlat='+lat+'&mlon='+lng+'&zoom=16">OpenStreetMap</a>';
|
||||||
var latLng = '<span><' + lat + ',' + lng +'></span>';
|
var latLng = '<span><' + lat + ',' + lng +'></span>';
|
||||||
dialog({
|
dialog({
|
||||||
html: '<div style="text-align: center;">' + qrcode + script + gmaps + '; ' + osm + '<br />' + latLng + '</div>',
|
html: '<div style="text-align: center;">' + qrcode + script + gmaps + '; ' + bingmaps + '; ' + osm + '<br />' + latLng + '</div>',
|
||||||
title: name,
|
title: name,
|
||||||
id: 'poslinks'
|
id: 'poslinks'
|
||||||
});
|
});
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.cradle.iitc_mobile"
|
package="com.cradle.iitc_mobile"
|
||||||
android:versionCode="18"
|
android:versionCode="19"
|
||||||
android:versionName="0.3.6" >
|
android:versionName="0.3.7" >
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="14"
|
android:minSdkVersion="14"
|
||||||
|
@ -75,13 +75,6 @@
|
|||||||
android:showAsAction="ifRoom"
|
android:showAsAction="ifRoom"
|
||||||
android:title="@string/action_settings">
|
android:title="@string/action_settings">
|
||||||
</item>
|
</item>
|
||||||
<item
|
|
||||||
android:id="@+id/cache_clear"
|
|
||||||
android:icon="@drawable/content_remove"
|
|
||||||
android:orderInCategory="150"
|
|
||||||
android:showAsAction="never"
|
|
||||||
android:title="@string/cache_clear">
|
|
||||||
</item>
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_debug"
|
android:id="@+id/menu_debug"
|
||||||
android:icon="@drawable/alerts_and_states_warning"
|
android:icon="@drawable/alerts_and_states_warning"
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
<string name="action_settings">Settings</string>
|
<string name="action_settings">Settings</string>
|
||||||
<string name="reload">Reload IITC</string>
|
<string name="reload">Reload IITC</string>
|
||||||
<string name="version">Print Version</string>
|
<string name="version">Print Version</string>
|
||||||
<string name="cache_clear">Clear Cache</string>
|
|
||||||
<string name="toggle_fullscreen">Toggle fullscreen</string>
|
<string name="toggle_fullscreen">Toggle fullscreen</string>
|
||||||
<string name="locate">Get Location</string>
|
<string name="locate">Get Location</string>
|
||||||
<string name="local">local</string>
|
<string name="local">local</string>
|
||||||
|
@ -23,7 +23,7 @@ public class IITC_JSInterface {
|
|||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void intentPosLink(String lat, String lng, String portal_name) {
|
public void intentPosLink(String lat, String lng, String portal_name) {
|
||||||
String uri = "geo:" + lat + "," + lng + "?q=" + lat + "," + lng
|
String uri = "geo:" + lat + "," + lng + "?q=" + lat + "," + lng
|
||||||
+ portal_name;
|
+ "%20(" + portal_name + ")";
|
||||||
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
|
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
|
||||||
Uri.parse(uri));
|
Uri.parse(uri));
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
|
@ -255,12 +255,6 @@ public class IITC_Mobile extends Activity {
|
|||||||
this.loadUrl(intel_url);
|
this.loadUrl(intel_url);
|
||||||
actionBar.setTitle(getString(R.string.menu_map));
|
actionBar.setTitle(getString(R.string.menu_map));
|
||||||
return true;
|
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 :
|
case R.id.toggle_fullscreen :
|
||||||
toggleFullscreen();
|
toggleFullscreen();
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package com.cradle.iitc_mobile;
|
package com.cradle.iitc_mobile;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.annotation.TargetApi;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
|
import android.os.Build;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -122,11 +124,20 @@ public class IITC_WebView extends WebView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||||
private boolean isConnectedToWifi() {
|
private boolean isConnectedToWifi() {
|
||||||
ConnectivityManager conMan = (ConnectivityManager) getContext()
|
ConnectivityManager conMan = (ConnectivityManager) getContext()
|
||||||
.getSystemService(Context.CONNECTIVITY_SERVICE);
|
.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
NetworkInfo wifi = conMan.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
|
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) {
|
public void disableJS(boolean val) {
|
||||||
|
50
plugins/speech-search.user.js
Normal file
50
plugins/speech-search.user.js
Normal file
@ -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);
|
Loading…
x
Reference in New Issue
Block a user