added new iitc mobile project
9
mobile/.gitignore
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
.settings/
|
||||||
|
assets/
|
||||||
|
bin/
|
||||||
|
gen/
|
||||||
|
libs/
|
||||||
|
proguard-project.txt
|
||||||
|
local.properties
|
31
mobile/AndroidManifest.xml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.cradle.iitc_mobile"
|
||||||
|
android:versionCode="1"
|
||||||
|
android:versionName="1.0" >
|
||||||
|
|
||||||
|
<uses-sdk
|
||||||
|
android:minSdkVersion="8"
|
||||||
|
android:targetSdkVersion="17" />
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:icon="@drawable/ingress_iitc"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:theme="@style/AppTheme" >
|
||||||
|
<activity
|
||||||
|
android:name="com.cradle.iitc_mobile.IITC_Mobile"
|
||||||
|
android:theme="@android:style/Theme.NoTitleBar"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:configChanges="orientation|keyboard|keyboardHidden|screenSize" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="src" path="gen"/>
|
|
||||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
|
||||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
|
||||||
<classpathentry kind="output" path="bin/classes"/>
|
|
||||||
</classpath>
|
|
@ -1,33 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>AppTemplate</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
@ -1,35 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
package="com.jakbox.ingressTC"
|
|
||||||
android:versionCode="1"
|
|
||||||
android:versionName="1.0" >
|
|
||||||
|
|
||||||
<uses-sdk
|
|
||||||
android:minSdkVersion="8"
|
|
||||||
android:targetSdkVersion="14" />
|
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_GPS" />
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS" />
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_LOCATION" />
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
|
|
||||||
<application
|
|
||||||
android:icon="@drawable/ic_launcher"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:hardwareAccelerated="false"
|
|
||||||
android:largeHeap="false"
|
|
||||||
android:debuggable="true">
|
|
||||||
<activity
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:name=".MainActivity"
|
|
||||||
android:configChanges="orientation|screenSize|keyboardHidden">
|
|
||||||
<intent-filter >
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
|
@ -1,6 +0,0 @@
|
|||||||
/** Automatically generated file. DO NOT MODIFY */
|
|
||||||
package com.jakbox.ingressTC;
|
|
||||||
|
|
||||||
public final class BuildConfig {
|
|
||||||
public final static boolean DEBUG = true;
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
/* AUTO-GENERATED FILE. DO NOT MODIFY.
|
|
||||||
*
|
|
||||||
* This class was automatically generated by the
|
|
||||||
* aapt tool from the resource data it found. It
|
|
||||||
* should not be modified by hand.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.jakbox.ingressTC;
|
|
||||||
|
|
||||||
public final class R {
|
|
||||||
public static final class attr {
|
|
||||||
}
|
|
||||||
public static final class drawable {
|
|
||||||
public static final int ic_launcher=0x7f020000;
|
|
||||||
}
|
|
||||||
public static final class layout {
|
|
||||||
public static final int main=0x7f030000;
|
|
||||||
}
|
|
||||||
public static final class raw {
|
|
||||||
public static final int loader=0x7f040000;
|
|
||||||
}
|
|
||||||
public static final class string {
|
|
||||||
public static final int app_name=0x7f050000;
|
|
||||||
public static final int first_page=0x7f050001;
|
|
||||||
public static final int jakboxBootLoader=0x7f050002;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
-optimizationpasses 5
|
|
||||||
-dontusemixedcaseclassnames
|
|
||||||
-dontskipnonpubliclibraryclasses
|
|
||||||
-dontpreverify
|
|
||||||
-verbose
|
|
||||||
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
|
|
||||||
|
|
||||||
-keep public class * extends android.app.Activity
|
|
||||||
-keep public class * extends android.app.Application
|
|
||||||
-keep public class * extends android.app.Service
|
|
||||||
-keep public class * extends android.content.BroadcastReceiver
|
|
||||||
-keep public class * extends android.content.ContentProvider
|
|
||||||
-keep public class * extends android.app.backup.BackupAgentHelper
|
|
||||||
-keep public class * extends android.preference.Preference
|
|
||||||
-keep public class com.android.vending.licensing.ILicensingService
|
|
||||||
|
|
||||||
-keepclasseswithmembernames class * {
|
|
||||||
native <methods>;
|
|
||||||
}
|
|
||||||
|
|
||||||
-keepclasseswithmembers class * {
|
|
||||||
public <init>(android.content.Context, android.util.AttributeSet);
|
|
||||||
}
|
|
||||||
|
|
||||||
-keepclasseswithmembers class * {
|
|
||||||
public <init>(android.content.Context, android.util.AttributeSet, int);
|
|
||||||
}
|
|
||||||
|
|
||||||
-keepclassmembers class * extends android.app.Activity {
|
|
||||||
public void *(android.view.View);
|
|
||||||
}
|
|
||||||
|
|
||||||
-keepclassmembers enum * {
|
|
||||||
public static **[] values();
|
|
||||||
public static ** valueOf(java.lang.String);
|
|
||||||
}
|
|
||||||
|
|
||||||
-keep class * implements android.os.Parcelable {
|
|
||||||
public static final android.os.Parcelable$Creator *;
|
|
||||||
}
|
|
Before Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 21 KiB |
@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:orientation="vertical" >
|
|
||||||
<TextView
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/first_page" />
|
|
||||||
</LinearLayout>
|
|
@ -1,13 +0,0 @@
|
|||||||
function rebuildUI() {
|
|
||||||
if(window.UIDone == true) { return; }
|
|
||||||
if(!document.getElementById("map_canvas")) {
|
|
||||||
setTimeout(rebuildUI, 50);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
window.UIDone = true;
|
|
||||||
}
|
|
||||||
window.console.log(window.deviceID);
|
|
||||||
window.loadJS("http://mathphys.fsk.uni-heidelberg.de:8000/test.js")
|
|
||||||
//window.Android.TCReady();
|
|
||||||
}
|
|
||||||
rebuildUI();
|
|
@ -1,17 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<string name="app_name">Ingress Intel Total Conversion</string>
|
|
||||||
<string name="first_page">Connecting to Ingress Intel Map ... </string>
|
|
||||||
<string name="jakboxBootLoader">
|
|
||||||
bootLoader = function() {
|
|
||||||
if(document.getElementById(\"map_canvas\")) {
|
|
||||||
window.stop();
|
|
||||||
document.body.innerHTML = "";
|
|
||||||
} else {
|
|
||||||
setTimeout(bootLoader, 50);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
setTimeout(bootLoader, 5);
|
|
||||||
</string>
|
|
||||||
|
|
||||||
</resources>
|
|
@ -1,149 +0,0 @@
|
|||||||
/********************************************************************************
|
|
||||||
Ingress Intel Total Converion - Mobile & Tablet
|
|
||||||
Android WebView wrapper/loader for iitc (ingress intel total conversion)
|
|
||||||
iitc source @ https://github.com/breunigs/ingress-intel-total-conversion
|
|
||||||
|
|
||||||
Original Author: Jason Grima - jason@jakbox.net
|
|
||||||
*********************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
package com.jakbox.ingressTC;
|
|
||||||
|
|
||||||
import android.app.*;
|
|
||||||
import android.os.*;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.view.*;
|
|
||||||
import android.widget.*;
|
|
||||||
import android.webkit.*;
|
|
||||||
import android.provider.Settings.Secure;
|
|
||||||
import android.util.Log;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.lang.StringBuffer;
|
|
||||||
|
|
||||||
public class MainActivity extends Activity
|
|
||||||
{
|
|
||||||
WebView web; // webview to hold the ingress site (and login etc)
|
|
||||||
WebView splash; // splash screen, just a bit of pretty
|
|
||||||
MyChrome chrome; // for logging, progress, etc
|
|
||||||
MyClient client; // for controlling the webview's
|
|
||||||
|
|
||||||
/** Called when the activity is first created. */
|
|
||||||
@Override
|
|
||||||
public void onCreate(Bundle savedInstanceState)
|
|
||||||
{
|
|
||||||
requestWindowFeature(Window.FEATURE_NO_TITLE); // hide the app title bar, Xeen requested
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
// little animated title/splash page for IngressIntelTC
|
|
||||||
// separate webview so we can be loading stuff in the background
|
|
||||||
JSInterface js = new JSInterface(this, this); //js.setActivity(this);
|
|
||||||
this.splash = new WebView(this);
|
|
||||||
splash.getSettings().setJavaScriptEnabled(true); // because we use JS to trigger the CSS animation
|
|
||||||
splash.getSettings().setAllowFileAccess(true); // because the splash page is store in the apk
|
|
||||||
splash.getSettings().setAllowFileAccessFromFileURLs(true); // in case we add more scripts/images to the splash page
|
|
||||||
splash.loadUrl("file:///android_asset/js/ingressSplash.html"); // there is is!
|
|
||||||
splash.addJavascriptInterface(js, "android");
|
|
||||||
setContentView(splash);
|
|
||||||
// righto, load the the website (ingress.com/intel) with a bunch of permissions that may/or not be needed
|
|
||||||
this.web = new WebView(this);
|
|
||||||
this.client = new MyClient();
|
|
||||||
web.setWebViewClient(this.client);
|
|
||||||
web.getSettings().setJavaScriptEnabled(true);
|
|
||||||
web.getSettings().setGeolocationEnabled(true);
|
|
||||||
web.getSettings().setAllowFileAccess(true);
|
|
||||||
web.getSettings().setAllowFileAccessFromFileURLs(true);
|
|
||||||
web.getSettings().setDatabaseEnabled(true);
|
|
||||||
web.getSettings().setDomStorageEnabled(true);
|
|
||||||
web.getSettings().setGeolocationEnabled(true);
|
|
||||||
|
|
||||||
this.chrome = new MyChrome(); // the chrome let's us get console and progress feedback from the page
|
|
||||||
web.setWebChromeClient(this.chrome);
|
|
||||||
web.addJavascriptInterface(js, "android"); // ready to go
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onRestoreInstanceState(Bundle state) {
|
|
||||||
this.splash.restoreState(state);
|
|
||||||
this.web.restoreState(state);
|
|
||||||
}
|
|
||||||
public void onSaveInstanceState(Bundle state) {
|
|
||||||
this.splash.saveState(state);
|
|
||||||
this.web.saveState(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void showWeb() { setContentView(web); splash.destroy(); Log.d("com.jakbox.ingressTC", "Flipping to web/ingress view"); }
|
|
||||||
public void showSplash() { setContentView(splash); web.destroy(); Log.d("com.jakbox.ingressTC", "Flipping to splash/loading"); }
|
|
||||||
|
|
||||||
final class JSInterface {
|
|
||||||
Context context; MainActivity act;
|
|
||||||
public JSInterface (Context c, MainActivity a) { this.context = c; this.act = a; }
|
|
||||||
public void setActivity(MainActivity a) { this.act = a; }
|
|
||||||
// the @JavascriptInterface is needed for 4.2 devices to access this
|
|
||||||
@JavascriptInterface
|
|
||||||
public void pageReady(int ready) {
|
|
||||||
if(ready != 0) {
|
|
||||||
// the loader reports we're good to go, switch to ingress webview
|
|
||||||
this.act.runOnUiThread(new Runnable() {
|
|
||||||
public void run() { showWeb(); }
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// the loader reports we're not ready, switch to splash page
|
|
||||||
this.act.runOnUiThread(new Runnable() {
|
|
||||||
public void run() { showSplash(); }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@JavascriptInterface
|
|
||||||
public void loadBehind(final String url) {
|
|
||||||
this.act.runOnUiThread(new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
Log.d("com.jakbox.ingressTC", "Loading (Ingress?) website in back webview");
|
|
||||||
web.loadUrl(url); /* push the url to the webview */ }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class MyClient extends WebViewClient {
|
|
||||||
@Override
|
|
||||||
public boolean shouldOverrideUrlLoading(WebView web, String Url) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPageFinished(WebView web, String Url) {
|
|
||||||
// here we conditionally load some external javascript
|
|
||||||
Log.d("com.jakbox.ingressTC", "Page loading, injecting IITC JS");
|
|
||||||
if(web.getUrl().contains("ingress.com/intel")) {
|
|
||||||
// if NOT ingress, we may have been redirected to the google auth/login page
|
|
||||||
web.loadUrl("javascript: window.stop(); ");
|
|
||||||
// first stop the page from loading too much
|
|
||||||
web.loadUrl("javascript: window.deviceID='"+Secure.getString(getContentResolver(), Secure.ANDROID_ID)+"'; ");
|
|
||||||
// create a JS loader on the page
|
|
||||||
web.loadUrl("javascript: if(!window.loadJS) { window.loadJS = function(scr) { var s = document.createElement('script'); s.src = scr+(scr.indexOf('file:///')==-1?'?ts="+System.currentTimeMillis()+"':''); s.type = 'text/javascript'; s.async = true; var st = document.getElementsByTagName('script')[0]; st.parentNode.insertBefore(s, st); } };");
|
|
||||||
// actually hijack the page... if it's the right page... let the loader deal with that
|
|
||||||
// should pull this loader into a local resource, maybe...
|
|
||||||
// running it from the web for now ...
|
|
||||||
web.loadUrl("javascript: if(!window.hijacked) { window.loadJS('http://mathphys.fsk.uni-heidelberg.de:8000/bootstrap.js'); window.hijacked = true;}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class MyChrome extends WebChromeClient {
|
|
||||||
@Override
|
|
||||||
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
|
|
||||||
// Always grant permission since the app itself requires location
|
|
||||||
// permission and the user has therefore already granted it
|
|
||||||
callback.invoke(origin, true, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean onConsoleMessage(ConsoleMessage cm) {
|
|
||||||
// log window.console stuff into the syslog for ADB output
|
|
||||||
Log.d("com.jakbox.ingressTC", cm.message() + " -- "
|
|
||||||
+ (cm.sourceId()==null?"main document":cm.sourceId())
|
|
||||||
+ ":Line " + cm.lineNumber() );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -43,10 +43,10 @@ How do I…?
|
|||||||
- **Login:** on tablets, this should just work. On smartphones you’ll see a black screen with some blue lines. This is the normal Ingress login page and you need to scroll to see the login button.
|
- **Login:** on tablets, this should just work. On smartphones you’ll see a black screen with some blue lines. This is the normal Ingress login page and you need to scroll to see the login button.
|
||||||
- **Clear Data/Cache:** Open app launcher and find the IITCM icon. Press-and-hold and then drag it to “App Info” on the top right of the screen. There’s a “clear data” and “clear cache” button.
|
- **Clear Data/Cache:** Open app launcher and find the IITCM icon. Press-and-hold and then drag it to “App Info” on the top right of the screen. There’s a “clear data” and “clear cache” button.
|
||||||
- **Logout:** Not possible from within the app. See *Clear Data/Cache* and use “clear data”.
|
- **Logout:** Not possible from within the app. See *Clear Data/Cache* and use “clear data”.
|
||||||
- **Reload:** Not possible from within the app. Instead, open your recent applications and force close IITCM. It should reload after restarting.
|
- **Reload:** Settings -> Reload IITC.
|
||||||
- **“Your account has not been enabled to play Ingress“**: See *Reload*.
|
- **“Your account has not been enabled to play Ingress“**: See *Reload*.
|
||||||
- **Install:** You can find this out yourself. If you don’t know how, then please wait for a more polished version of IITCM.
|
- **Install:** You can find this out yourself. If you don’t know how, then please wait for a more polished version of IITCM.
|
||||||
- **Update:** You can check if there’s a new APK build by looking at the [apk_version](https://github.com/breunigs/ingress-intel-total-conversion/raw/gh-pages/mobile/apk_version file)[.](https://mathphys.fsk.uni-heidelberg.de/~stefan/test/IngressIntelTC.apk) It contains the date of the last update. The app uses the latest IITC hourly build automatically. You may need to clear your cache to force a reload, see *Clear Data/Cache*. Also note that the dot after “apk_version” is the download link to the APK.
|
- **Update:** You can check if there’s a new APK build by looking at [our appspot](https://iitcserv.appspot.com/mobile/). It contains the date of the last update. The app uses the latest IITC hourly build automatically. You may need to clear your cache to force a reload, see *Clear Data/Cache*.
|
||||||
|
|
||||||
How does this basically work?
|
How does this basically work?
|
||||||
-----------------------------
|
-----------------------------
|
||||||
@ -66,10 +66,17 @@ Debugging IITC(M) **before** it has booted requires the Android Developer Tools.
|
|||||||
Building the APK
|
Building the APK
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
No idea. Please write docs and send patches.
|
- **Eclipse:** Just import this project and klick the build button.
|
||||||
|
- **ant:**
|
||||||
|
Set the ANDROID_HOME environment variable
|
||||||
|
`export ANDROID_HOME=/path/to/android_sdk`
|
||||||
|
Build the project with ant
|
||||||
|
`ant debug`
|
||||||
|
|
||||||
|
|
||||||
Download APK
|
Download APK
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
https://iitcserv.appspot.com/mobile/IITC-Mobile-latest.apk
|
||||||
|
|
||||||
Well, glad you read to the end. Enjoy and send patches, bug reports, postcards and love. (If you are wondering where the download link is, I’m wondering if you have actually read the page.)
|
Well, glad you read to the end. Enjoy and send patches, bug reports, postcards and love. (If you are wondering where the download link is, I’m wondering if you have actually read the page.)
|
||||||
|
@ -1 +0,0 @@
|
|||||||
0.1-2013-02-23
|
|
59
mobile/bootstrap.js
vendored
@ -1,59 +0,0 @@
|
|||||||
var rebuidAttemptCount=0;
|
|
||||||
var iitcReadyCount=0;
|
|
||||||
var iitcURL;
|
|
||||||
|
|
||||||
function rebuildUI() {
|
|
||||||
// this is sub-optimal, but we need a way to know if we're on a login page, or the real page.
|
|
||||||
if(document.getElementById('dashboard_container')) {
|
|
||||||
var dash = document.getElementById('dashboard_container');
|
|
||||||
// dashboard is there, not conclusive
|
|
||||||
if(dash.childNodes[0].innerHTML == 'Welcome to Ingress') {
|
|
||||||
// not really 'ready', but the user needs the page for login purposes
|
|
||||||
android.pageReady(1);
|
|
||||||
return;
|
|
||||||
} else if(!document.getElementById('map_canvas')) {
|
|
||||||
// not loaded yet? we'll wait
|
|
||||||
if(rebuidAttemptCount < 10) { // wait up to 5 seconds, then assume failure and show the page
|
|
||||||
setTimeout(rebuildUI, 500);
|
|
||||||
rebuidAttemptCount++;
|
|
||||||
if(window.console) { console.log('Looking for Ingress Intel UI elements: ' + rebuidAttemptCount); }
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
if(window.console) { console.log('Something is wrong, flipping views'); }
|
|
||||||
android.pageReady(1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
window.UIDone = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.console.log(window.deviceID);
|
|
||||||
window.console.log(navigator.userAgent);
|
|
||||||
|
|
||||||
switch(window.deviceID) {
|
|
||||||
case '41ddb619ea1fe75a': // blakjakau - TABLET
|
|
||||||
iitcURL = 'http://mathphys.fsk.uni-heidelberg.de:8000/test.js';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'f30c2cce86c1c7': // breunigs
|
|
||||||
iitcURL = 'http://mathphys.fsk.uni-heidelberg.de:8000/test.js';
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
iitcURL = 'http://mathphys.fsk.uni-heidelberg.de:8000/test.js';
|
|
||||||
}
|
|
||||||
window.loadJS(iitcURL); // load iitc and let it do its thing.
|
|
||||||
window.iitcReadyTimer = setInterval(function() {
|
|
||||||
if(window.iitcLoaded == true || iitcReadyCount > 10) {
|
|
||||||
//wait up to 10 seconds from calling iitc to fliping the webviews
|
|
||||||
//if for some reason iitc isn't loading, the user will just get the vanila ingres.com/intel experience
|
|
||||||
try {
|
|
||||||
android.pageReady(1); // tell the app to flip the webviews
|
|
||||||
clearInterval(window.iitcReadyTimer); // and we're done.
|
|
||||||
} catch(e) { if(window.console) { console.log(e.message); } }
|
|
||||||
}
|
|
||||||
iitcReadyCount++;
|
|
||||||
}, 500);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
rebuildUI();
|
|
92
mobile/build.xml
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project name="IITC_Mobile" default="help">
|
||||||
|
|
||||||
|
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||||
|
It contains the path to the SDK. It should *NOT* be checked into
|
||||||
|
Version Control Systems. -->
|
||||||
|
<property file="local.properties" />
|
||||||
|
|
||||||
|
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||||
|
'android' tool to add properties to it.
|
||||||
|
This is the place to change some Ant specific build properties.
|
||||||
|
Here are some properties you may want to change/update:
|
||||||
|
|
||||||
|
source.dir
|
||||||
|
The name of the source directory. Default is 'src'.
|
||||||
|
out.dir
|
||||||
|
The name of the output directory. Default is 'bin'.
|
||||||
|
|
||||||
|
For other overridable properties, look at the beginning of the rules
|
||||||
|
files in the SDK, at tools/ant/build.xml
|
||||||
|
|
||||||
|
Properties related to the SDK location or the project target should
|
||||||
|
be updated using the 'android' tool with the 'update' action.
|
||||||
|
|
||||||
|
This file is an integral part of the build system for your
|
||||||
|
application and should be checked into Version Control Systems.
|
||||||
|
|
||||||
|
-->
|
||||||
|
<property file="ant.properties" />
|
||||||
|
|
||||||
|
<!-- if sdk.dir was not set from one of the property file, then
|
||||||
|
get it from the ANDROID_HOME env var.
|
||||||
|
This must be done before we load project.properties since
|
||||||
|
the proguard config can use sdk.dir -->
|
||||||
|
<property environment="env" />
|
||||||
|
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
||||||
|
<isset property="env.ANDROID_HOME" />
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<!-- The project.properties file is created and updated by the 'android'
|
||||||
|
tool, as well as ADT.
|
||||||
|
|
||||||
|
This contains project specific properties such as project target, and library
|
||||||
|
dependencies. Lower level build properties are stored in ant.properties
|
||||||
|
(or in .classpath for Eclipse projects).
|
||||||
|
|
||||||
|
This file is an integral part of the build system for your
|
||||||
|
application and should be checked into Version Control Systems. -->
|
||||||
|
<loadproperties srcFile="project.properties" />
|
||||||
|
|
||||||
|
<!-- quick check on sdk.dir -->
|
||||||
|
<fail
|
||||||
|
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
||||||
|
unless="sdk.dir"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Import per project custom build rules if present at the root of the project.
|
||||||
|
This is the place to put custom intermediary targets such as:
|
||||||
|
-pre-build
|
||||||
|
-pre-compile
|
||||||
|
-post-compile (This is typically used for code obfuscation.
|
||||||
|
Compiled code location: ${out.classes.absolute.dir}
|
||||||
|
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||||
|
-post-package
|
||||||
|
-post-build
|
||||||
|
-pre-clean
|
||||||
|
-->
|
||||||
|
<import file="custom_rules.xml" optional="true" />
|
||||||
|
|
||||||
|
<!-- Import the actual build file.
|
||||||
|
|
||||||
|
To customize existing targets, there are two options:
|
||||||
|
- Customize only one target:
|
||||||
|
- copy/paste the target into this file, *before* the
|
||||||
|
<import> task.
|
||||||
|
- customize it to your needs.
|
||||||
|
- Customize the whole content of build.xml
|
||||||
|
- copy/paste the content of the rules files (minus the top node)
|
||||||
|
into this file, replacing the <import> task.
|
||||||
|
- customize to your needs.
|
||||||
|
|
||||||
|
***********************
|
||||||
|
****** IMPORTANT ******
|
||||||
|
***********************
|
||||||
|
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||||
|
in order to avoid having your file be overridden by tools such as "android update project"
|
||||||
|
-->
|
||||||
|
<!-- version-tag: 1 -->
|
||||||
|
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||||
|
|
||||||
|
</project>
|
6
mobile/lint.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<lint>
|
||||||
|
<issue id="SetJavaScriptEnabled">
|
||||||
|
<ignore path="src/com/cradle/ittc_mobile/iitc_webview.java" />
|
||||||
|
</issue>
|
||||||
|
</lint>
|
@ -3,9 +3,12 @@
|
|||||||
#
|
#
|
||||||
# This file must be checked in Version Control Systems.
|
# This file must be checked in Version Control Systems.
|
||||||
#
|
#
|
||||||
# To customize properties used by the Ant build system use,
|
# To customize properties used by the Ant build system edit
|
||||||
# "ant.properties", and override values to adapt the script to your
|
# "ant.properties", and override values to adapt the script to your
|
||||||
# project structure.
|
# project structure.
|
||||||
|
#
|
||||||
|
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||||
|
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||||
|
|
||||||
# Project target.
|
# Project target.
|
||||||
target=android-10
|
target=android-17
|
BIN
mobile/release/IITCMobile.apk
Normal file
BIN
mobile/res/drawable-hdpi/ingress_iitc.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
mobile/res/drawable-mdpi/ingress_iitc.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
mobile/res/drawable-xhdpi/ingress_iitc.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
mobile/res/drawable-xxhdpi/ingress_iitc.png
Normal file
After Width: | Height: | Size: 21 KiB |
6
mobile/res/layout/activity_main.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<com.cradle.iitc_mobile.IITC_WebView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/webview"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
/>
|
7
mobile/res/menu/main.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
|
<item android:id="@+id/reload_button"
|
||||||
|
android:orderInCategory="100"
|
||||||
|
android:showAsAction="never"
|
||||||
|
android:title="@string/reload"></item>
|
||||||
|
|
||||||
|
</menu>
|
8
mobile/res/values-sw600dp/dimens.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<resources>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Customize dimensions originally defined in res/values/dimens.xml (such as
|
||||||
|
screen margins) for sw600dp devices (e.g. 7" tablets) here.
|
||||||
|
-->
|
||||||
|
|
||||||
|
</resources>
|
9
mobile/res/values-sw720dp-land/dimens.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<resources>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Customize dimensions originally defined in res/values/dimens.xml (such as
|
||||||
|
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
|
||||||
|
-->
|
||||||
|
<dimen name="activity_horizontal_margin">128dp</dimen>
|
||||||
|
|
||||||
|
</resources>
|
11
mobile/res/values-v11/styles.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<resources>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Base application theme for API 11+. This theme completely replaces
|
||||||
|
AppBaseTheme from res/values/styles.xml on API 11+ devices.
|
||||||
|
-->
|
||||||
|
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
|
||||||
|
<!-- API 11 theme customizations can go here. -->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</resources>
|
12
mobile/res/values-v14/styles.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<resources>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Base application theme for API 14+. This theme completely replaces
|
||||||
|
AppBaseTheme from BOTH res/values/styles.xml and
|
||||||
|
res/values-v11/styles.xml on API 14+ devices.
|
||||||
|
-->
|
||||||
|
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
|
||||||
|
<!-- API 14 theme customizations can go here. -->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</resources>
|
7
mobile/res/values/dimens.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<resources>
|
||||||
|
|
||||||
|
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||||
|
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||||
|
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||||
|
|
||||||
|
</resources>
|
8
mobile/res/values/strings.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<string name="app_name">IITC mobile</string>
|
||||||
|
<string name="action_settings">Settings</string>
|
||||||
|
<string name="reload">Reload IITC</string>
|
||||||
|
|
||||||
|
</resources>
|
20
mobile/res/values/styles.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<resources>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Base application theme, dependent on API level. This theme is replaced
|
||||||
|
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
|
||||||
|
-->
|
||||||
|
<style name="AppBaseTheme" parent="android:Theme.Light">
|
||||||
|
<!--
|
||||||
|
Theme customizations available in newer API levels can go in
|
||||||
|
res/values-vXX/styles.xml, while customizations related to
|
||||||
|
backward-compatibility can go here.
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!-- Application theme. -->
|
||||||
|
<style name="AppTheme" parent="AppBaseTheme">
|
||||||
|
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</resources>
|
92
mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
package com.cradle.iitc_mobile;
|
||||||
|
|
||||||
|
import com.cradle.iitc_mobile.R;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.View.OnTouchListener;
|
||||||
|
import android.webkit.WebChromeClient;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
public class IITC_Mobile extends Activity {
|
||||||
|
|
||||||
|
private IITC_WebView iitc_view;
|
||||||
|
private boolean back_button_pressed = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
|
// we do not want to reload our page every time we switch orientations...
|
||||||
|
// so restore state if activity was already created
|
||||||
|
if(savedInstanceState != null) {
|
||||||
|
((IITC_WebView)findViewById(R.id.webview)).restoreState(savedInstanceState);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// load new iitc web view with ingress intel page
|
||||||
|
iitc_view= (IITC_WebView) findViewById(R.id.webview);
|
||||||
|
iitc_view.setWebChromeClient(new WebChromeClient());
|
||||||
|
iitc_view.loadUrl("https://www.ingress.com/intel");
|
||||||
|
|
||||||
|
// listen to touches (think we need this)
|
||||||
|
iitc_view.setOnTouchListener(new OnTouchListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
|
back_button_pressed = false;
|
||||||
|
// return false to indicate, that we don't consumed this event. this leads
|
||||||
|
// to the execution of our touch event
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// save instance state to avoid reloading on orientation change
|
||||||
|
@Override
|
||||||
|
protected void onSaveInstanceState(Bundle outState) {
|
||||||
|
iitc_view.saveState(outState);
|
||||||
|
}
|
||||||
|
|
||||||
|
// we want a self defined behavior on resume
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
this.back_button_pressed = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// we want a self defined behavior for the back button
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
if (this.back_button_pressed) {
|
||||||
|
super.onBackPressed();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.back_button_pressed = true;
|
||||||
|
Toast.makeText(this, "Press twice to exit", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
// Inflate the menu; this adds items to the action bar if it is present.
|
||||||
|
getMenuInflater().inflate(R.menu.main, menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
// Handle item selection
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case R.id.reload_button:
|
||||||
|
iitc_view.reload();
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
46
mobile/src/com/cradle/iitc_mobile/IITC_WebView.java
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
package com.cradle.iitc_mobile;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.webkit.WebSettings;
|
||||||
|
import android.webkit.WebView;
|
||||||
|
|
||||||
|
@SuppressLint("SetJavaScriptEnabled")
|
||||||
|
public class IITC_WebView extends WebView {
|
||||||
|
|
||||||
|
private WebSettings settings;
|
||||||
|
private IITC_WebViewClient webclient;
|
||||||
|
|
||||||
|
// init web view
|
||||||
|
private void iitc_init() {
|
||||||
|
settings = this.getSettings();
|
||||||
|
settings.setJavaScriptEnabled(true);
|
||||||
|
settings.setDomStorageEnabled(true);
|
||||||
|
settings.setAllowFileAccess(true);
|
||||||
|
|
||||||
|
webclient = new IITC_WebViewClient();
|
||||||
|
this.setWebViewClient(webclient);
|
||||||
|
}
|
||||||
|
|
||||||
|
// constructors -------------------------------------------------
|
||||||
|
public IITC_WebView(Context context) {
|
||||||
|
super(context);
|
||||||
|
|
||||||
|
iitc_init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IITC_WebView(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
|
||||||
|
iitc_init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IITC_WebView(Context context, AttributeSet attrs, int defStyle) {
|
||||||
|
super(context, attrs, defStyle);
|
||||||
|
|
||||||
|
iitc_init();
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------
|
||||||
|
|
||||||
|
}
|
37
mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package com.cradle.iitc_mobile;
|
||||||
|
|
||||||
|
import android.net.http.SslError;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.webkit.CookieManager;
|
||||||
|
import android.webkit.SslErrorHandler;
|
||||||
|
import android.webkit.WebView;
|
||||||
|
import android.webkit.WebViewClient;
|
||||||
|
|
||||||
|
public class IITC_WebViewClient extends WebViewClient {
|
||||||
|
|
||||||
|
// enable https
|
||||||
|
@Override
|
||||||
|
public void onReceivedSslError (WebView view, SslErrorHandler handler, SslError error) {
|
||||||
|
handler.proceed() ;
|
||||||
|
};
|
||||||
|
|
||||||
|
// injecting IITC when page is loaded
|
||||||
|
@Override
|
||||||
|
public void onPageFinished(WebView web, String Url) {
|
||||||
|
Log.d("loading finish", web.getUrl());
|
||||||
|
if (web.getUrl().contains("ingress.com/intel") && !web.getUrl().contains("accounts")) {
|
||||||
|
// first check for cookies, than inject javascript
|
||||||
|
// this enables the user to login if necessary
|
||||||
|
CookieManager cm = CookieManager.getInstance();
|
||||||
|
final String cookie = cm.getCookie("https://www.ingress.com/intel");
|
||||||
|
if(cookie != null) {
|
||||||
|
web.loadUrl("javascript: (function() { "
|
||||||
|
+ "var script=document.createElement('script');"
|
||||||
|
+ "script.type='text/javascript';"
|
||||||
|
+ "script.src='https://iitcserv.appspot.com/iitc-nightly/iitc-nightly-latest.user.js';"
|
||||||
|
+ "document.getElementsByTagName('head').item(0).appendChild(script);"
|
||||||
|
+ "})()");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|