From 430824825f320e34feb753a6246e9dc4ed4f3e81 Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Fri, 3 May 2013 01:02:08 +0200 Subject: [PATCH 1/7] added new developer options (fix for 219) --- build.py | 2 +- mobile/AndroidManifest.xml | 4 +- mobile/res/values/strings.xml | 3 + mobile/res/xml/preferences.xml | 6 ++ .../com/cradle/iitc_mobile/IITC_Mobile.java | 3 +- .../com/cradle/iitc_mobile/IITC_WebView.java | 2 + .../iitc_mobile/IITC_WebViewClient.java | 71 +++++++++++++++---- 7 files changed, 71 insertions(+), 20 deletions(-) diff --git a/build.py b/build.py index 55ac2f0a..055c2ef8 100755 --- a/build.py +++ b/build.py @@ -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") diff --git a/mobile/AndroidManifest.xml b/mobile/AndroidManifest.xml index a9d1bb84..5f8f4c37 100644 --- a/mobile/AndroidManifest.xml +++ b/mobile/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="14" + android:versionName="0.3.3" > Display user location Show users position on map Developer options + Enable developer options + 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/. IITC source \ No newline at end of file diff --git a/mobile/res/xml/preferences.xml b/mobile/res/xml/preferences.xml index e485de40..226a97b9 100644 --- a/mobile/res/xml/preferences.xml +++ b/mobile/res/xml/preferences.xml @@ -38,6 +38,12 @@ android:summary="" android:defaultValue="local"/> + + 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 options 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 options 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(); From aa7de6f571578a9dab5545626c8569336e6958a6 Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Fri, 3 May 2013 01:02:08 +0200 Subject: [PATCH 2/7] added new developer options (fix for #219) --- build.py | 2 +- mobile/AndroidManifest.xml | 4 +- mobile/res/values/strings.xml | 3 + mobile/res/xml/preferences.xml | 6 ++ .../com/cradle/iitc_mobile/IITC_Mobile.java | 3 +- .../com/cradle/iitc_mobile/IITC_WebView.java | 2 + .../iitc_mobile/IITC_WebViewClient.java | 71 +++++++++++++++---- 7 files changed, 71 insertions(+), 20 deletions(-) diff --git a/build.py b/build.py index 55ac2f0a..055c2ef8 100755 --- a/build.py +++ b/build.py @@ -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") diff --git a/mobile/AndroidManifest.xml b/mobile/AndroidManifest.xml index a9d1bb84..5f8f4c37 100644 --- a/mobile/AndroidManifest.xml +++ b/mobile/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="14" + android:versionName="0.3.3" > Display user location Show users position on map Developer options + Enable developer options + 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/. IITC source \ No newline at end of file diff --git a/mobile/res/xml/preferences.xml b/mobile/res/xml/preferences.xml index e485de40..226a97b9 100644 --- a/mobile/res/xml/preferences.xml +++ b/mobile/res/xml/preferences.xml @@ -38,6 +38,12 @@ android:summary="" android:defaultValue="local"/> + + 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 options 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 options 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(); From 01b891a7a4b8a405e9258b95e17e831a41f93dfa Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Fri, 3 May 2013 01:16:17 +0200 Subject: [PATCH 3/7] added preference category 'misc'...moved plugins and iitc source to misc --- mobile/res/values/strings.xml | 1 + mobile/res/xml/preferences.xml | 44 ++++++++++++++++++---------------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/mobile/res/values/strings.xml b/mobile/res/values/strings.xml index 80b91852..414f431f 100644 --- a/mobile/res/values/strings.xml +++ b/mobile/res/values/strings.xml @@ -32,6 +32,7 @@ UI + Misc Plugins Available plugins Force desktop mode diff --git a/mobile/res/xml/preferences.xml b/mobile/res/xml/preferences.xml index 226a97b9..5b4bb43d 100644 --- a/mobile/res/xml/preferences.xml +++ b/mobile/res/xml/preferences.xml @@ -12,32 +12,36 @@ - - - + + + + + + + - - Date: Fri, 3 May 2013 01:23:59 +0200 Subject: [PATCH 4/7] removed old github link from about dialog. It does not exists anymore... --- mobile/res/values/strings.xml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mobile/res/values/strings.xml b/mobile/res/values/strings.xml index 414f431f..7a8272fd 100644 --- a/mobile/res/values/strings.xml +++ b/mobile/res/values/strings.xml @@ -25,10 +25,8 @@ is continued on a fork of jonatkins.

Website:
http://iitc.jonatkins.com/

- Fork github:
- https://github.com/jonatkins/ingress-intel-total-conversion

- Old github:
- https://github.com/breunigs/ingress-intel-total-conversion]]> + IITC on Github:
+ https://github.com/jonatkins/ingress-intel-total-conversion]]> UI From 9aa8aaa59dc5a8c1e7f0f80ee05c59f64c07ca28 Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Fri, 3 May 2013 01:27:57 +0200 Subject: [PATCH 5/7] updated hacking.md --- mobile/HACKING.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mobile/HACKING.md b/mobile/HACKING.md index 76d8d54e..a3250ddb 100644 --- a/mobile/HACKING.md +++ b/mobile/HACKING.md @@ -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 --------- From 2c59ae0eaf4497869a1a4d7220cd6c5848fc683b Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Fri, 3 May 2013 01:33:07 +0200 Subject: [PATCH 6/7] change name of dev options to dev mode --- mobile/res/values/strings.xml | 4 ++-- mobile/res/xml/preferences.xml | 4 ++-- .../com/cradle/iitc_mobile/IITC_WebViewClient.java | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mobile/res/values/strings.xml b/mobile/res/values/strings.xml index 7a8272fd..26a51274 100644 --- a/mobile/res/values/strings.xml +++ b/mobile/res/values/strings.xml @@ -38,8 +38,8 @@ Display user location Show users position on map Developer options - Enable developer options - If enabled, all IITC sources will be loaded from external storage of the Android device. + Enable developer mode + 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/. IITC source diff --git a/mobile/res/xml/preferences.xml b/mobile/res/xml/preferences.xml index 5b4bb43d..432b0eab 100644 --- a/mobile/res/xml/preferences.xml +++ b/mobile/res/xml/preferences.xml @@ -44,8 +44,8 @@ Date: Fri, 3 May 2013 01:37:36 +0200 Subject: [PATCH 7/7] updated mobile README.md --- mobile/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mobile/README.md b/mobile/README.md index 24bed1fc..074034ff 100644 --- a/mobile/README.md +++ b/mobile/README.md @@ -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)