diff options
Diffstat (limited to 'maven/jp4da/jp4da-android')
16 files changed, 557 insertions, 0 deletions
diff --git a/maven/jp4da/jp4da-android/.classpath b/maven/jp4da/jp4da-android/.classpath new file mode 100644 index 0000000..9d5b680 --- /dev/null +++ b/maven/jp4da/jp4da-android/.classpath @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> + <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> + <classpathentry kind="src" path="gen"/> + <classpathentry including="**/*.java" kind="src" path="src/main/resources"/> + <classpathentry including="**/*.java" kind="src" path="src/test/resources"/> + <classpathentry kind="src" output="bin/classes" path="src/main/java"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="src" output="bin/classes" path="src/test/java"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry exported="true" kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="output" path="bin/classes"/> +</classpath> diff --git a/maven/jp4da/jp4da-android/.project b/maven/jp4da/jp4da-android/.project new file mode 100644 index 0000000..a38df40 --- /dev/null +++ b/maven/jp4da/jp4da-android/.project @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>jp4da-android</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> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>com.android.ide.eclipse.adt.AndroidNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + </natures> +</projectDescription> diff --git a/maven/jp4da/jp4da-android/.settings/org.eclipse.core.resources.prefs b/maven/jp4da/jp4da-android/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..29abf99 --- /dev/null +++ b/maven/jp4da/jp4da-android/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/<project>=UTF-8 diff --git a/maven/jp4da/jp4da-android/.settings/org.eclipse.jdt.core.prefs b/maven/jp4da/jp4da-android/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..abec6ca --- /dev/null +++ b/maven/jp4da/jp4da-android/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/maven/jp4da/jp4da-android/.settings/org.eclipse.m2e.core.prefs b/maven/jp4da/jp4da-android/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/maven/jp4da/jp4da-android/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/maven/jp4da/jp4da-android/AndroidManifest.xml b/maven/jp4da/jp4da-android/AndroidManifest.xml new file mode 100644 index 0000000..87a4683 --- /dev/null +++ b/maven/jp4da/jp4da-android/AndroidManifest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest + xmlns:android="http://schemas.android.com/apk/res/android" + package="com.io7m.examples.jp4da" + android:versionCode="1" + android:versionName="1.0"> + <uses-sdk android:targetSdkVersion="8" android:minSdkVersion="8"/> + <application android:label="@string/app_name" > + <activity android:name="MainActivity" android:label="@string/app_name"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> +</manifest> diff --git a/maven/jp4da/jp4da-android/ant.properties b/maven/jp4da/jp4da-android/ant.properties new file mode 100644 index 0000000..b0971e8 --- /dev/null +++ b/maven/jp4da/jp4da-android/ant.properties @@ -0,0 +1,17 @@ +# This file is used to override default values used by the Ant build system. +# +# This file must be checked into Version Control Systems, as it is +# integral to the build system of your project. + +# This file is only used by the Ant script. + +# You can use this to override default values such as +# 'source.dir' for the location of your java source folder and +# 'out.dir' for the location of your output folder. + +# You can also use it define how the release builds are signed by declaring +# the following properties: +# 'key.store' for the location of your keystore and +# 'key.alias' for the name of the key to use. +# The password will be asked during the build when you use the 'release' target. + diff --git a/maven/jp4da/jp4da-android/gen/com/io7m/examples/jp4da/BuildConfig.java b/maven/jp4da/jp4da-android/gen/com/io7m/examples/jp4da/BuildConfig.java new file mode 100644 index 0000000..0946581 --- /dev/null +++ b/maven/jp4da/jp4da-android/gen/com/io7m/examples/jp4da/BuildConfig.java @@ -0,0 +1,6 @@ +/** Automatically generated file. DO NOT MODIFY */ +package com.io7m.examples.jp4da; + +public final class BuildConfig { + public final static boolean DEBUG = true; +}
\ No newline at end of file diff --git a/maven/jp4da/jp4da-android/gen/com/io7m/examples/jp4da/R.java b/maven/jp4da/jp4da-android/gen/com/io7m/examples/jp4da/R.java new file mode 100644 index 0000000..b3a441d --- /dev/null +++ b/maven/jp4da/jp4da-android/gen/com/io7m/examples/jp4da/R.java @@ -0,0 +1,19 @@ +/* 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.io7m.examples.jp4da; + +public final class R { + public static final class attr { + } + public static final class layout { + public static final int main=0x7f020000; + } + public static final class string { + public static final int app_name=0x7f030000; + } +} diff --git a/maven/jp4da/jp4da-android/local.properties b/maven/jp4da/jp4da-android/local.properties new file mode 100644 index 0000000..9e8740e --- /dev/null +++ b/maven/jp4da/jp4da-android/local.properties @@ -0,0 +1,10 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. + +# location of the SDK. This is only used by Ant +# For customization when using a Version Control System, please read the +# header note. +sdk.dir=/home/m0/local/android-sdk-linux diff --git a/maven/jp4da/jp4da-android/pom.xml b/maven/jp4da/jp4da-android/pom.xml new file mode 100644 index 0000000..54c7b9b --- /dev/null +++ b/maven/jp4da/jp4da-android/pom.xml @@ -0,0 +1,292 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project + xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + <groupId>com.io7m.examples.jp4da</groupId> + <artifactId>jp4da-android</artifactId> + <version>1.0.0</version> + <name>jp4da-android</name> + <description>Android code</description> + <packaging>apk</packaging> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + </properties> + + <dependencies> + <dependency> + <groupId>com.io7m.examples.jp4da</groupId> + <artifactId>jp4da-core</artifactId> + <version>1.0.0</version> + + <!-- + The jp4da-core project depends on jogl-all in order to type-check/compile, + and therefore will be added as a transitive dependency of this project. However, + this is an Android package and wants to use the Android JOGL package. Obviously, + it's not possible to use both, so this exclusion tells Maven that the dependency + introduced by jp4da-core on JOGL should be ignored. + --> + + <exclusions> + <exclusion> + <groupId>org.jogamp.jogl</groupId> + <artifactId>jogl-all</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>com.google.android</groupId> + <artifactId>android</artifactId> + <version>1.6_r2</version> + <scope>provided</scope> + </dependency> + + <!-- Depend on the gluegen runtime Android package --> + <dependency> + <groupId>org.jogamp.gluegen</groupId> + <artifactId>gluegen-rt-android</artifactId> + <version>2.0-rc11</version> + </dependency> + <!-- Depend on the correct natives for Android --> + <dependency> + <groupId>org.jogamp.gluegen</groupId> + <artifactId>gluegen-rt</artifactId> + <version>2.0-rc11</version> + <classifier>natives-android-armv6</classifier> + </dependency> + <!-- Depend on the jogl Android package --> + <dependency> + <groupId>org.jogamp.jogl</groupId> + <artifactId>jogl-all-android</artifactId> + <version>2.0-rc11</version> + </dependency> + <!-- Depend on the correct natives for Android --> + <dependency> + <groupId>org.jogamp.jogl</groupId> + <artifactId>jogl-all</artifactId> + <version>2.0-rc11</version> + <classifier>natives-android-armv6</classifier> + <scope>runtime</scope> + </dependency> + </dependencies> + + <build> + <finalName>${project.artifactId}</finalName> + + <pluginManagement> + <plugins> + <plugin> + <groupId>com.jayway.maven.plugins.android.generation2</groupId> + <artifactId>android-maven-plugin</artifactId> + <version>3.4.2-SNAPSHOT</version> + <extensions>true</extensions> + </plugin> + + <!-- Mark certain plugins as ignored in Eclipse. Has no effect on the build. --> + <plugin> + <groupId>org.eclipse.m2e</groupId> + <artifactId>lifecycle-mapping</artifactId> + <version>1.0.0</version> + <configuration> + <lifecycleMappingMetadata> + <pluginExecutions> + <pluginExecution> + <pluginExecutionFilter> + <groupId> + org.apache.maven.plugins + </groupId> + <artifactId> + maven-dependency-plugin + </artifactId> + <versionRange>[2.6,)</versionRange> + <goals> + <goal>unpack</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore></ignore> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + </plugins> + </pluginManagement> + + <plugins> + + <!-- + First, it's necessary to unpack the native libraries from the JOGL + and GlueGen jar files, into the correct "libs" directory. The "libs" + directory is then processed by the Android Maven plugin and placed + in the correct location in the APK for use. + + Then, it's necessary to unpack assets from the JOGL jar file into + the "assets" directory. This directory is then processed by the + Android Maven plugin, as expected. + --> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>2.6</version> + <executions> + + <!-- Unpack the JOGL natives --> + + <execution> + <id>unpack-jogl-natives</id> + <phase>generate-resources</phase> + <goals> + <goal>unpack</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>org.jogamp.jogl</groupId> + <artifactId>jogl-all</artifactId> + <version>2.0-rc11</version> + <classifier>natives-android-armv6</classifier> + <overWrite>true</overWrite> + <outputDirectory>${project.basedir}/libs/armeabi</outputDirectory> + <includes>lib*.so</includes> + </artifactItem> + </artifactItems> + </configuration> + </execution> + + <!-- Unpack the JOGL assets --> + <!-- In other words, copy anything from the jar file that isn't a class file --> + + <execution> + <id>unpack-jogl-assets</id> + <phase>generate-resources</phase> + <goals> + <goal>unpack</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>org.jogamp.jogl</groupId> + <artifactId>jogl-all-android</artifactId> + <version>2.0-rc11</version> + <overWrite>true</overWrite> + <outputDirectory>${project.basedir}/assets</outputDirectory> + <excludes>**/*.class</excludes> + </artifactItem> + </artifactItems> + </configuration> + </execution> + + <!-- Unpack the GlueGen natives --> + + <execution> + <id>unpack-gluegen-natives</id> + <phase>generate-resources</phase> + <goals> + <goal>unpack</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>org.jogamp.gluegen</groupId> + <artifactId>gluegen-rt</artifactId> + <version>2.0-rc11</version> + <classifier>natives-android-armv6</classifier> + <overWrite>true</overWrite> + <outputDirectory>${project.basedir}/libs/armeabi</outputDirectory> + <includes>lib*.so</includes> + </artifactItem> + </artifactItems> + </configuration> + </execution> + </executions> + </plugin> + + <!-- + Next, because there have been files unpacked to non-standard + locations, it's necessary to tell the "clean" plugin to delete + the unpacked files (for the sake of keeping things tidy). + --> + + <plugin> + <artifactId>maven-clean-plugin</artifactId> + <version>2.5</version> + <configuration> + <filesets> + <fileset> + <directory>${project.basedir}/libs/armeabi</directory> + <includes> + <include>libgluegen-rt.so</include> + <include>libnewt.so</include> + <include>libjogl_mobile.so</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + + <!-- + Note that if you don't use the "assets" directory + for anything else in your project, you can probably + just delete the whole thing, rather than picking + things carefully in the manner shown here. + --> + + <fileset> + <directory>${project.basedir}/assets</directory> + <includes> + <include>META-INF/**</include> + <include>com/**</include> + <include>jogl/**</include> + <include>jogamp/**</include> + <include>javax/**</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + </filesets> + </configuration> + </plugin> + + <!-- + The default behaviour for the Android Maven plugin is to + attempt to include everything that isn't a class file from every + dependency jar. Because we already manually included the assets + and native libraries using the "dependency" plugin above, it's + necessary to tell the Android Maven plugin to exclude the jar + files matching the given patterns from the inclusion process. + + This saves roughly 4mb of redundant files from being included + in the final APK, at the time of writing. + --> + + <plugin> + <groupId>com.jayway.maven.plugins.android.generation2</groupId> + <artifactId>android-maven-plugin</artifactId> + <configuration> + <sdk> + <platform>8</platform> + </sdk> + </configuration> + <executions> + <execution> + <goals> + <goal>apk</goal> + </goals> + <configuration> + <excludeJarResources> + <excludeJarResource>jogl-.*\.jar$</excludeJarResource> + <excludeJarResource>gluegen-rt-.*\.jar$</excludeJarResource> + </excludeJarResources> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/maven/jp4da/jp4da-android/proguard-project.txt b/maven/jp4da/jp4da-android/proguard-project.txt new file mode 100644 index 0000000..f2fe155 --- /dev/null +++ b/maven/jp4da/jp4da-android/proguard-project.txt @@ -0,0 +1,20 @@ +# 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 *; +#} diff --git a/maven/jp4da/jp4da-android/project.properties b/maven/jp4da/jp4da-android/project.properties new file mode 100644 index 0000000..85aac54 --- /dev/null +++ b/maven/jp4da/jp4da-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-8 diff --git a/maven/jp4da/jp4da-android/res/layout/main.xml b/maven/jp4da/jp4da-android/res/layout/main.xml new file mode 100644 index 0000000..c74a6df --- /dev/null +++ b/maven/jp4da/jp4da-android/res/layout/main.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + > + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="HELLO!" /> + +</LinearLayout> + diff --git a/maven/jp4da/jp4da-android/res/values/strings.xml b/maven/jp4da/jp4da-android/res/values/strings.xml new file mode 100644 index 0000000..0be1647 --- /dev/null +++ b/maven/jp4da/jp4da-android/res/values/strings.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="app_name">MainActivity</string> +</resources> diff --git a/maven/jp4da/jp4da-android/src/main/java/com/io7m/examples/jp4da/MainActivity.java b/maven/jp4da/jp4da-android/src/main/java/com/io7m/examples/jp4da/MainActivity.java new file mode 100644 index 0000000..9a9dd77 --- /dev/null +++ b/maven/jp4da/jp4da-android/src/main/java/com/io7m/examples/jp4da/MainActivity.java @@ -0,0 +1,67 @@ +package com.io7m.examples.jp4da; + +import javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLProfile; + +import jogamp.newt.driver.android.NewtBaseActivity; +import android.os.Bundle; + +import com.jogamp.newt.ScreenMode; +import com.jogamp.newt.event.MouseAdapter; +import com.jogamp.newt.event.MouseEvent; +import com.jogamp.newt.event.ScreenModeListener; +import com.jogamp.newt.opengl.GLWindow; +import com.jogamp.opengl.util.Animator; + +public class MainActivity extends NewtBaseActivity +{ + @Override public void onCreate( + final Bundle state) + { + super.onCreate(state); + + final GLCapabilities caps = + new GLCapabilities(GLProfile.get(GLProfile.GLES2)); + final GLWindow gl_window = GLWindow.create(caps); + gl_window.setFullscreen(true); + + this.setContentView(this.getWindow(), gl_window); + + gl_window.addMouseListener(new MouseAdapter() { + @Override public void mousePressed( + final MouseEvent e) + { + if (e.getPressure() > 2f) { // show Keyboard + ((com.jogamp.newt.Window) e.getSource()).setKeyboardVisible(true); + } + } + }); + + final Example example = new Example(); + + // demo.enableAndroidTrace(true); + gl_window.addGLEventListener(example); + gl_window.getScreen().addScreenModeListener(new ScreenModeListener() { + @SuppressWarnings("unused") public void screenModeChangeNotify( + final ScreenMode sm) + { + // Nothing. + } + + @SuppressWarnings("unused") public void screenModeChanged( + final ScreenMode sm, + final boolean success) + { + System.err.println("ScreenMode Changed: " + sm); + } + }); + + final Animator animator = new Animator(gl_window); + this.setAnimator(animator); + + gl_window.setVisible(true); + animator.setUpdateFPSFrames(60, System.err); + animator.resetFPSCounter(); + gl_window.resetFPSCounter(); + } +} |