diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-09-10 22:59:32 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-09-10 22:59:32 +0200 |
commit | 86e0e122a475dfd4f627fc95a9458e7527d72a00 (patch) | |
tree | 6c85c5b28d1f94cf146b16039f6df27aeeb484d3 /android | |
download | RustAndDust-86e0e122a475dfd4f627fc95a9458e7527d72a00.zip RustAndDust-86e0e122a475dfd4f627fc95a9458e7527d72a00.tar.gz |
Initial commit
Diffstat (limited to 'android')
-rw-r--r-- | android/AndroidManifest.xml | 26 | ||||
-rw-r--r-- | android/assets/badlogic.jpg | bin | 0 -> 68465 bytes | |||
-rw-r--r-- | android/build.gradle | 121 | ||||
-rw-r--r-- | android/ic_launcher-web.png | bin | 0 -> 51394 bytes | |||
-rw-r--r-- | android/proguard-project.txt | 42 | ||||
-rw-r--r-- | android/project.properties | 14 | ||||
-rw-r--r-- | android/res/drawable-hdpi/ic_launcher.png | bin | 0 -> 7658 bytes | |||
-rw-r--r-- | android/res/drawable-mdpi/ic_launcher.png | bin | 0 -> 3777 bytes | |||
-rw-r--r-- | android/res/drawable-xhdpi/ic_launcher.png | bin | 0 -> 12516 bytes | |||
-rw-r--r-- | android/res/drawable-xxhdpi/ic_launcher.png | bin | 0 -> 24777 bytes | |||
-rw-r--r-- | android/res/values/strings.xml | 6 | ||||
-rw-r--r-- | android/res/values/styles.xml | 12 | ||||
-rw-r--r-- | android/src/ch/asynk/tankontank/android/AndroidLauncher.java | 16 |
13 files changed, 237 insertions, 0 deletions
diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml new file mode 100644 index 0000000..b1bc868 --- /dev/null +++ b/android/AndroidManifest.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="ch.asynk.tankontank.android" + android:versionCode="1" + android:versionName="1.0" > + + <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="20" /> + + <application + android:allowBackup="true" + android:icon="@drawable/ic_launcher" + android:label="@string/app_name" + android:theme="@style/GdxTheme" > + <activity + android:name="ch.asynk.tankontank.android.AndroidLauncher" + android:label="@string/app_name" + android:screenOrientation="landscape" + android:configChanges="keyboard|keyboardHidden|orientation|screenSize"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> + +</manifest> diff --git a/android/assets/badlogic.jpg b/android/assets/badlogic.jpg Binary files differnew file mode 100644 index 0000000..4390da6 --- /dev/null +++ b/android/assets/badlogic.jpg diff --git a/android/build.gradle b/android/build.gradle new file mode 100644 index 0000000..6fcf85b --- /dev/null +++ b/android/build.gradle @@ -0,0 +1,121 @@ +android { + buildToolsVersion "20.0.0" + compileSdkVersion 20 + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = ['src'] + aidl.srcDirs = ['src'] + renderscript.srcDirs = ['src'] + res.srcDirs = ['res'] + assets.srcDirs = ['assets'] + } + + instrumentTest.setRoot('tests') + } +} + +// needed to add JNI shared libraries to APK when compiling on CLI +tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask -> + pkgTask.jniFolders = new HashSet<File>() + pkgTask.jniFolders.add(new File(projectDir, 'libs')) +} + +// called every time gradle gets executed, takes the native dependencies of +// the natives configuration, and extracts them to the proper libs/ folders +// so they get packed with the APK. +task copyAndroidNatives() { + file("libs/armeabi/").mkdirs(); + file("libs/armeabi-v7a/").mkdirs(); + file("libs/x86/").mkdirs(); + + configurations.natives.files.each { jar -> + def outputDir = null + if(jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a") + if(jar.name.endsWith("natives-armeabi.jar")) outputDir = file("libs/armeabi") + if(jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86") + if(outputDir != null) { + copy { + from zipTree(jar) + into outputDir + include "*.so" + } + } + } +} + +task run(type: Exec) { + def path + def localProperties = project.file("../local.properties") + if (localProperties.exists()) { + Properties properties = new Properties() + localProperties.withInputStream { instr -> + properties.load(instr) + } + def sdkDir = properties.getProperty('sdk.dir') + if (sdkDir) { + path = sdkDir + } else { + path = "$System.env.ANDROID_HOME" + } + } else { + path = "$System.env.ANDROID_HOME" + } + + def adb = path + "/platform-tools/adb" + commandLine "$adb", 'shell', 'am', 'start', '-n', 'ch.asynk.tankontank.android/ch.asynk.tankontank.android.AndroidLauncher' +} + +// sets up the Android Eclipse project, using the old Ant based build. +eclipse { + // need to specify Java source sets explicitely, SpringSource Gradle Eclipse plugin + // ignores any nodes added in classpath.file.withXml + sourceSets { + main { + java.srcDirs "src", 'gen' + } + } + + jdt { + sourceCompatibility = 1.6 + targetCompatibility = 1.6 + } + + classpath { + plusConfigurations += project.configurations.compile + containers 'com.android.ide.eclipse.adt.ANDROID_FRAMEWORK', 'com.android.ide.eclipse.adt.LIBRARIES' + } + + project { + name = appName + "-android" + natures 'com.android.ide.eclipse.adt.AndroidNature' + buildCommands.clear(); + buildCommand "com.android.ide.eclipse.adt.ResourceManagerBuilder" + buildCommand "com.android.ide.eclipse.adt.PreCompilerBuilder" + buildCommand "org.eclipse.jdt.core.javabuilder" + buildCommand "com.android.ide.eclipse.adt.ApkBuilder" + } +} + +// sets up the Android Idea project, using the old Ant based build. +idea { + module { + sourceDirs += file("src"); + scopes = [ COMPILE: [plus:[project.configurations.compile]]] + + iml { + withXml { + def node = it.asNode() + def builder = NodeBuilder.newInstance(); + builder.current = node; + builder.component(name: "FacetManager") { + facet(type: "android", name: "Android") { + configuration { + option(name: "UPDATE_PROPERTY_FILES", value:"true") + } + } + } + } + } + } +} diff --git a/android/ic_launcher-web.png b/android/ic_launcher-web.png Binary files differnew file mode 100644 index 0000000..a18cbb4 --- /dev/null +++ b/android/ic_launcher-web.png diff --git a/android/proguard-project.txt b/android/proguard-project.txt new file mode 100644 index 0000000..88c3958 --- /dev/null +++ b/android/proguard-project.txt @@ -0,0 +1,42 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +-verbose + +-dontwarn android.support.** +-dontwarn com.badlogic.gdx.backends.android.AndroidFragmentApplication +-dontwarn com.badlogic.gdx.utils.GdxBuild +-dontwarn com.badlogic.gdx.physics.box2d.utils.Box2DBuild +-dontwarn com.badlogic.gdx.jnigen.BuildTarget* + +-keepclassmembers class com.badlogic.gdx.backends.android.AndroidInput* { + <init>(com.badlogic.gdx.Application, android.content.Context, java.lang.Object, com.badlogic.gdx.backends.android.AndroidApplicationConfiguration); +} + +-keepclassmembers class com.badlogic.gdx.physics.box2d.World { + boolean contactFilter(long, long); + void beginContact(long); + void endContact(long); + void preSolve(long, long); + void postSolve(long, long); + boolean reportFixture(long); + float reportRayFixture(long, float, float, float, float, float); +} diff --git a/android/project.properties b/android/project.properties new file mode 100644 index 0000000..4ab1256 --- /dev/null +++ b/android/project.properties @@ -0,0 +1,14 @@ +# 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 edit +# "ant.properties", and override values to adapt the script to your +# 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. +target=android-19 diff --git a/android/res/drawable-hdpi/ic_launcher.png b/android/res/drawable-hdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..288b665 --- /dev/null +++ b/android/res/drawable-hdpi/ic_launcher.png diff --git a/android/res/drawable-mdpi/ic_launcher.png b/android/res/drawable-mdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..6ae570b --- /dev/null +++ b/android/res/drawable-mdpi/ic_launcher.png diff --git a/android/res/drawable-xhdpi/ic_launcher.png b/android/res/drawable-xhdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..d4fb7cd --- /dev/null +++ b/android/res/drawable-xhdpi/ic_launcher.png diff --git a/android/res/drawable-xxhdpi/ic_launcher.png b/android/res/drawable-xxhdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..85a6081 --- /dev/null +++ b/android/res/drawable-xxhdpi/ic_launcher.png diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml new file mode 100644 index 0000000..7566cd6 --- /dev/null +++ b/android/res/values/strings.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <string name="app_name">TankOnTank</string> + +</resources> diff --git a/android/res/values/styles.xml b/android/res/values/styles.xml new file mode 100644 index 0000000..3f00fc5 --- /dev/null +++ b/android/res/values/styles.xml @@ -0,0 +1,12 @@ +<resources> + + <style name="GdxTheme" parent="android:Theme"> + <item name="android:windowBackground">@android:color/transparent</item> + <item name="android:colorBackgroundCacheHint">@null</item> + <item name="android:windowAnimationStyle">@android:style/Animation</item> + <item name="android:windowNoTitle">true</item> + <item name="android:windowContentOverlay">@null</item> + <item name="android:windowFullscreen">true</item> + </style> + +</resources> diff --git a/android/src/ch/asynk/tankontank/android/AndroidLauncher.java b/android/src/ch/asynk/tankontank/android/AndroidLauncher.java new file mode 100644 index 0000000..eded114 --- /dev/null +++ b/android/src/ch/asynk/tankontank/android/AndroidLauncher.java @@ -0,0 +1,16 @@ +package ch.asynk.tankontank.android; + +import android.os.Bundle; + +import com.badlogic.gdx.backends.android.AndroidApplication; +import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; +import ch.asynk.tankontank.TankOnTank; + +public class AndroidLauncher extends AndroidApplication { + @Override + protected void onCreate (Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); + initialize(new TankOnTank(), config); + } +} |