merge ingress intel total conversion mobile (iitcm). APK and related things by blakjakau. Thank you!

This commit is contained in:
Stefan Breunig
2013-02-23 13:06:30 +01:00
parent 50cd70f903
commit c12cc349cb
18 changed files with 516 additions and 0 deletions

View File

@ -0,0 +1,8 @@
<?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>

View File

@ -0,0 +1,33 @@
<?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>

View File

@ -0,0 +1,35 @@
<?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>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
/** Automatically generated file. DO NOT MODIFY */
package com.jakbox.ingressTC;
public final class BuildConfig {
public final static boolean DEBUG = true;
}

View File

@ -0,0 +1,27 @@
/* 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;
}
}

View File

@ -0,0 +1,40 @@
-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 *;
}

View File

@ -0,0 +1,11 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=android-10

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -0,0 +1,10 @@
<?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>

View File

@ -0,0 +1,13 @@
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();

View File

@ -0,0 +1,17 @@
<?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>

View File

@ -0,0 +1,149 @@
/********************************************************************************
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;
}
}
}