Merge branch 'master' into experimental

This commit is contained in:
Jon Atkins 2013-05-03 02:04:24 +01:00
commit 8fa14bf93e
13 changed files with 134 additions and 52 deletions

View File

@ -220,7 +220,7 @@ if buildMobile:
os.makedirs("mobile/assets")
except:
pass
shutil.copy(os.path.join(outDir,"total-conversion-build.user.js"), "mobile/assets/iitc.js")
shutil.copy(os.path.join(outDir,"total-conversion-build.user.js"), "mobile/assets/total-conversion-build.user.js")
# copy the user location script into the mobile folder.
shutil.copy(os.path.join(outDir,"user-location.user.js"), "mobile/assets/user-location.user.js")

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="13"
android:versionName="0.3.2" >
android:versionCode="15"
android:versionName="0.3.3" >
<uses-sdk
android:minSdkVersion="14"

View File

@ -7,6 +7,11 @@ Communication from app to script is handled by loading Javascript function calls
Communication from script to app is handled by the JavascriptInterface (see /mobile/src/com/cradle/iitc\_mobile/IITC_JSInterface.java). If a method ```foo(String)``` is defined in JSInterface, it can be called by ```android.foo("Hello World")``` in the IITC script.
Developing IITC and Plugins for IITC Mobile
-------------------------------------------
The developer mode can be enabled in the settings. Create a folder ```IITC_Mobile/dev/``` on your external storage of your Android device and copy the sources from ```$IITC_folder/build/mobile/``` to it. If the developer mode is enabled all sources will be loaded from there.
Debugging
---------

View File

@ -5,7 +5,9 @@ The Android App behaves like the desktop version, but uses the mobile view, whic
- it should be much faster than the standard mobile ingress intel map
- a gmaps intent is sent, when a portals Map link is clicked (lets you navigate to portals)
- plugin support
- a geo intent is sent, when a portals Map link is clicked (lets you navigate to portals)
- a geolocate button (you have to enable GPS satellites + location access to use this feature)

View File

@ -25,13 +25,12 @@
is continued on a fork of <a href="https://github.com/jonatkins"><b>jonatkins</b></a>.<br><br>
<b>Website:</b><br>
<a href="http://iitc.jonatkins.com/">http://iitc.jonatkins.com/</a><br><br>
<b>Fork github:</b><br>
<a href="https://github.com/jonatkins/ingress-intel-total-conversion">https://github.com/jonatkins/ingress-intel-total-conversion</a><br><br>
<b>Old github:</b><br>
<a href="https://github.com/breunigs/ingress-intel-total-conversion">https://github.com/breunigs/ingress-intel-total-conversion</a>]]>
<b>IITC on Github:</b><br>
<a href="https://github.com/jonatkins/ingress-intel-total-conversion">https://github.com/jonatkins/ingress-intel-total-conversion</a>]]>
</string>
<string name="pref_ui_cat">UI</string>
<string name="pref_misc_cat">Misc</string>
<string name="pref_plugins">Plugins</string>
<string name="pref_plugins_title">Available plugins</string>
<string name="pref_force_desktop">Force desktop mode</string>
@ -39,6 +38,9 @@
<string name="pref_user_loc">Display user location</string>
<string name="pref_user_loc_sum">Show users position on map</string>
<string name="pref_developer_options">Developer options</string>
<string name="pref_enable_dev_mode">Enable developer mode</string>
<string name="pref_enable_dev_mode_sum">If enabled, all IITC sources will be loaded from external storage of the Android device.
Please copy all sources from $IITC_folder/build/mobile/ to /sdcard/IITC_Mobile/dev/.</string>
<string name="pref_select_iitc">IITC source</string>
</resources>

View File

@ -12,31 +12,41 @@
<PreferenceCategory
android:key="pref_about_cat"
android:title="@string/pref_ui_cat">
<CheckBoxPreference
android:key="pref_force_desktop"
android:title="@string/pref_force_desktop"
android:summary="@string/pref_force_desktop_sum"
android:defaultValue="false" />
<CheckBoxPreference
android:key="pref_user_loc"
android:title="@string/pref_user_loc"
android:summary="@string/pref_user_loc_sum"
android:defaultValue="false" />
<MultiSelectListPreference
android:key="pref_plugins"
android:title="@string/pref_plugins"
android:dialogTitle="@string/pref_plugins_title"/>
<CheckBoxPreference
android:key="pref_force_desktop"
android:title="@string/pref_force_desktop"
android:summary="@string/pref_force_desktop_sum"
android:defaultValue="false" />
<CheckBoxPreference
android:key="pref_user_loc"
android:title="@string/pref_user_loc"
android:summary="@string/pref_user_loc_sum"
android:defaultValue="false" />
</PreferenceCategory>
<PreferenceCategory
android:key="pref_mics"
android:title="@string/pref_misc_cat">
<EditTextPreference
android:key="pref_iitc_source"
android:title="@string/pref_select_iitc"
android:summary="Load IITC main script from url or use local script. Currently used source: "
android:defaultValue="local"/>
<MultiSelectListPreference
android:key="pref_plugins"
android:title="@string/pref_plugins"
android:dialogTitle="@string/pref_plugins_title"/>
</PreferenceCategory>
<PreferenceCategory
android:key="pref_developer_options"
android:title="@string/pref_developer_options">
<EditTextPreference
android:key="pref_iitc_source"
android:title="@string/pref_select_iitc"
android:summary=""
android:defaultValue="local"/>
<CheckBoxPreference
android:key="pref_dev_checkbox"
android:title="@string/pref_enable_dev_mode"
android:summary="@string/pref_enable_dev_mode_sum"
android:defaultValue="false" />
<ListPreference
android:key="pref_build_version"

View File

@ -53,9 +53,8 @@ public class IITC_Mobile extends Activity {
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (key.equals("pref_force_desktop"))
desktop = sharedPreferences.getBoolean("pref_force_desktop", false);
if (key.equals("pref_user_loc")) {
if (key.equals("pref_user_loc"))
user_loc = sharedPreferences.getBoolean("pref_user_loc", false);
}
IITC_Mobile.this.loadUrl(intel_url);
}
};

View File

@ -23,6 +23,8 @@ public class IITC_WebView extends WebView {
settings.setAllowFileAccess(true);
settings.setGeolocationEnabled(true);
settings.setDatabasePath(this.getContext().getApplicationInfo().dataDir + "/databases/");
settings.setAppCachePath(this.getContext().getApplicationInfo().dataDir + "/cache/");
settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
this.js_interface = new IITC_JSInterface(c);
this.addJavascriptInterface(js_interface, "android");

View File

@ -6,14 +6,17 @@ import android.content.SharedPreferences;
import android.content.res.AssetManager;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.util.Log;
import android.webkit.SslErrorHandler;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStream;
import java.io.IOException;
import java.net.URL;
@ -27,10 +30,13 @@ public class IITC_WebViewClient extends WebViewClient {
private WebResourceResponse iitcjs;
private String js = null;
private String dev_path = null;
Context context;
public IITC_WebViewClient(Context c) {
this.context = c;
this.dev_path = Environment.getExternalStorageDirectory().getPath() +
"/IITC_Mobile/dev/";
try {
loadIITC_JS(c);
} catch(IOException e) {
@ -39,7 +45,9 @@ public class IITC_WebViewClient extends WebViewClient {
}
public String getIITCVersion() {
String header = js.substring(js.indexOf("==UserScript=="), js.indexOf("==/UserScript=="));
String header = "";
if (js != null)
header = js.substring(js.indexOf("==UserScript=="), js.indexOf("==/UserScript=="));
// remove new line comments
header = header.replace("\n//", "");
// get a list of key-value
@ -53,22 +61,40 @@ public class IITC_WebViewClient extends WebViewClient {
}
public void loadIITC_JS(Context c) throws java.io.IOException {
// in developer options, you are able to load the script from external source
// You are able to load the script from external source
// if a http address is given, use script from this address. else use the local script
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(c);
String iitc_source = sharedPref.getString("pref_iitc_source", "local");
String js = "";
if (iitc_source.contains("http")) {
URL url = new URL(iitc_source);
js = new Scanner(url.openStream(), "UTF-8").useDelimiter("\\A").next();
// if developer mode are enabled, load all iitc script from external storage
if (sharedPref.getBoolean("pref_dev_checkbox", true)) {
File js_file = new File(dev_path + "total-conversion-build.user.js");
if (!js_file.exists()) {
Toast.makeText(context, "File " + dev_path +
"total-conversion-build.user.js not found. " +
"Disable developer mode or add iitc files " +
"to the dev folder.", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(context, "Developer mode enabled", Toast.LENGTH_SHORT).show();
}
Scanner s = null;
s = new Scanner(js_file).useDelimiter("\\A");
if (s != null) js = s.hasNext() ? s.next() : "";
} else {
InputStream input;
input = c.getAssets().open("iitc.js");
int size = input.available();
byte[] buffer = new byte[size];
input.read(buffer);
input.close();
js = new String(buffer);
// load iitc script from web or asset folder
if (iitc_source.contains("http")) {
URL url = new URL(iitc_source);
js = new Scanner(url.openStream(), "UTF-8").useDelimiter("\\A").next();
} else {
InputStream input;
input = c.getAssets().open("total-conversion-build.user.js");
int size = input.available();
byte[] buffer = new byte[size];
input.read(buffer);
input.close();
js = new String(buffer);
}
}
this.js = js;
@ -101,6 +127,7 @@ public class IITC_WebViewClient extends WebViewClient {
// get the plugin preferences
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context);
Set<String> plugin_list = sharedPref.getStringSet("pref_plugins", null);
boolean dev_enabled = sharedPref.getBoolean("pref_dev_checkbox", true);
// iterate through all enabled plugins and load them
if (plugin_list != null) {
@ -114,7 +141,14 @@ public class IITC_WebViewClient extends WebViewClient {
Scanner s = null;
String src = "";
try {
s = new Scanner(am.open("plugins/" + plugin_array[i])).useDelimiter("\\A");
// load plugins from external storage if dev mode are enabled
if (dev_enabled) {
File js_file = new File(dev_path + "plugins/" + plugin_array[i]);
s = new Scanner(js_file).useDelimiter("\\A");
}
else
// load plugins from asset folder
s = new Scanner(am.open("plugins/" + plugin_array[i])).useDelimiter("\\A");
} catch (IOException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
@ -127,16 +161,23 @@ public class IITC_WebViewClient extends WebViewClient {
// inject the user location script if enabled in settings
if (sharedPref.getBoolean("pref_user_loc", false))
enableTracking(view);
enableTracking(view, dev_enabled);
}
public void enableTracking(WebView view) {
public void enableTracking(WebView view, boolean dev_enabled) {
Log.d("iitcm", "enable tracking...");
AssetManager am = context.getAssets();
Scanner s = null;
String src = "";
try {
s = new Scanner(am.open("user-location.user.js")).useDelimiter("\\A");
// load plugin from external storage if dev mode are enabled
if (dev_enabled) {
File js_file = new File(dev_path + "user-location.user.js");
s = new Scanner(js_file).useDelimiter("\\A");
}
else
// load plugin from asset folder
s = new Scanner(am.open("user-location.user.js")).useDelimiter("\\A");
} catch (IOException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();

View File

@ -13,15 +13,22 @@ offers many more features. It is available for
<h3>Latest news</h3>
<h4>2nd May 2013</h4>
<p>
IITC version 0.11.3 has been released. This should vastly reduce the chance of getting REQUEST_FAILED errors
while scrolling/zooming the map frequently. The passcode redemption code has been updated, and there are improvements
to the URL link handling. The portals-list plugin has been updated, and bug fixes made to the
player tracker. A new plugin to show portal levels as numbers has been added too.
</p>
<p>
IITC Mobile 0.3.2 is also available. Along with the above, this includes a new option to show your current
position on the map.
</p>
<h4>28th April 2013</h4>
<p>
New website launched! A major revamp of the website has been made. Thanks to the various users who contributed
logos and site templates.
</p>
<h4>26th April 2013</h4>
<p>
IITC 0.11.2 released. This has a minor fix relating to portal visibility at different zoom levels. We now have to
match the standard intel site. This does, unfortunately, mean you need to zoom even closer to see unclaimed portals.
Also, an update to the scoreboard plugin has been released that should make it work again.
</p>
<a class="btn btn-small" href="?page=news">Older news</a>

View File

@ -40,7 +40,7 @@ IITC Mobile is still in the early stages of development. Many things do not yet
include_once ( "code/mobile-download.php" );
$apkfile = "mobile/IITC-Mobile-0.3.apk";
$apkfile = "release/IITC_Mobile-release.apk";
if ( file_exists($apkfile) )

View File

@ -1,5 +1,17 @@
<h2>News</h2>
<h4>2nd May 2013</h4>
<p>
IITC version 0.11.3 has been released. This should vastly reduce the chance of getting REQUEST_FAILED errors
while scrolling/zooming the map frequently. The passcode redemption code has been updated, and there are improvements
to the URL link handling. The portals-list plugin has been updated, and bug fixes made to the
player tracker. A new plugin to show portal levels as numbers has been added too.
</p>
<p>
IITC Mobile 0.3.2 is also available. Along with the above, this includes a new option to show your current
position on the map.
</p>
<h4>28th April 2013</h4>
<p>
New website launched! A major revamp of the website has been made. Thanks to the various users who contributed

View File

@ -19,6 +19,8 @@ include_once ( "code/desktop-download.php" );
$path = "test";
if ( $_REQUEST['build'] == 'experimental' )
$path = "experimental";
if ( $_REQUEST['build'] == 'dev' )
$path = "dev";