Merge branch 'master' into android_login

This commit is contained in:
Felix Kloft 2013-05-15 11:56:08 +02:00
commit db42329234
8 changed files with 71 additions and 22 deletions

View File

@ -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 = '<div id="qrcode"></div>';
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 latLng = '<span>&lt;' + lat + ',' + lng +'&gt;</span>';
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,
id: 'poslinks'
});

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cradle.iitc_mobile"
android:versionCode="18"
android:versionName="0.3.6" >
android:versionCode="19"
android:versionName="0.3.7" >
<uses-sdk
android:minSdkVersion="14"

View File

@ -75,13 +75,6 @@
android:showAsAction="ifRoom"
android:title="@string/action_settings">
</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
android:id="@+id/menu_debug"
android:icon="@drawable/alerts_and_states_warning"

View File

@ -5,7 +5,6 @@
<string name="action_settings">Settings</string>
<string name="reload">Reload IITC</string>
<string name="version">Print Version</string>
<string name="cache_clear">Clear Cache</string>
<string name="toggle_fullscreen">Toggle fullscreen</string>
<string name="locate">Get Location</string>
<string name="local">local</string>

View File

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

View File

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

View File

@ -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) {

View 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);