# HG changeset patch # User Malte Bayer # Date 1321994195 -3600 # Node ID 0bb6f12124fd76d4bf015bf93f0ea980e1d78d3a # Parent a399f9d5e672d74dfc5247713ad9a787736cdda4 added android trackscanner project diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/.classpath --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trackscanner/.classpath Tue Nov 22 21:36:35 2011 +0100 @@ -0,0 +1,8 @@ + + + + + + + + diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/.project --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trackscanner/.project Tue Nov 22 21:36:35 2011 +0100 @@ -0,0 +1,33 @@ + + + Freeslot TrackScanner + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/AndroidManifest.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trackscanner/AndroidManifest.xml Tue Nov 22 21:36:35 2011 +0100 @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/bin/Freeslot TrackScanner.apk Binary file trackscanner/bin/Freeslot TrackScanner.apk has changed diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/bin/classes.dex Binary file trackscanner/bin/classes.dex has changed diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/bin/classes/de/neosoft/trackscanner/R$attr.class Binary file trackscanner/bin/classes/de/neosoft/trackscanner/R$attr.class has changed diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/bin/classes/de/neosoft/trackscanner/R$drawable.class Binary file trackscanner/bin/classes/de/neosoft/trackscanner/R$drawable.class has changed diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/bin/classes/de/neosoft/trackscanner/R$id.class Binary file trackscanner/bin/classes/de/neosoft/trackscanner/R$id.class has changed diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/bin/classes/de/neosoft/trackscanner/R$layout.class Binary file trackscanner/bin/classes/de/neosoft/trackscanner/R$layout.class has changed diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/bin/classes/de/neosoft/trackscanner/R$string.class Binary file trackscanner/bin/classes/de/neosoft/trackscanner/R$string.class has changed diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/bin/classes/de/neosoft/trackscanner/R.class Binary file trackscanner/bin/classes/de/neosoft/trackscanner/R.class has changed diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/bin/classes/de/neosoft/trackscanner/TrackScannerActivity.class Binary file trackscanner/bin/classes/de/neosoft/trackscanner/TrackScannerActivity.class has changed diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/bin/res/drawable-hdpi/ic_launcher.png Binary file trackscanner/bin/res/drawable-hdpi/ic_launcher.png has changed diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/bin/res/drawable-ldpi/ic_launcher.png Binary file trackscanner/bin/res/drawable-ldpi/ic_launcher.png has changed diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/bin/res/drawable-mdpi/ic_launcher.png Binary file trackscanner/bin/res/drawable-mdpi/ic_launcher.png has changed diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/bin/resources.ap_ Binary file trackscanner/bin/resources.ap_ has changed diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/gen/de/neosoft/trackscanner/R.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trackscanner/gen/de/neosoft/trackscanner/R.java Tue Nov 22 21:36:35 2011 +0100 @@ -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 de.neosoft.trackscanner; + +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 id { + public static final int editText1=0x7f050000; + public static final int editText2=0x7f050001; + } + public static final class layout { + public static final int main=0x7f030000; + } + public static final class string { + public static final int app_name=0x7f040001; + public static final int hello=0x7f040000; + } +} diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/proguard.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trackscanner/proguard.cfg Tue Nov 22 21:36:35 2011 +0100 @@ -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 ; +} + +-keepclasseswithmembers class * { + public (android.content.Context, android.util.AttributeSet); +} + +-keepclasseswithmembers class * { + public (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 *; +} diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/project.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trackscanner/project.properties Tue Nov 22 21:36:35 2011 +0100 @@ -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-8 diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/res/drawable-hdpi/ic_launcher.png Binary file trackscanner/res/drawable-hdpi/ic_launcher.png has changed diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/res/drawable-ldpi/ic_launcher.png Binary file trackscanner/res/drawable-ldpi/ic_launcher.png has changed diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/res/drawable-mdpi/ic_launcher.png Binary file trackscanner/res/drawable-mdpi/ic_launcher.png has changed diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/res/layout/main.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trackscanner/res/layout/main.xml Tue Nov 22 21:36:35 2011 +0100 @@ -0,0 +1,28 @@ + + + + + + + + + + + + + \ No newline at end of file diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/res/values/strings.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trackscanner/res/values/strings.xml Tue Nov 22 21:36:35 2011 +0100 @@ -0,0 +1,7 @@ + + + + Hello World, TrackScannerActivity! + Freeslot TrackScanner + + \ No newline at end of file diff -r a399f9d5e672 -r 0bb6f12124fd trackscanner/src/de/neosoft/trackscanner/TrackScannerActivity.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trackscanner/src/de/neosoft/trackscanner/TrackScannerActivity.java Tue Nov 22 21:36:35 2011 +0100 @@ -0,0 +1,110 @@ +package de.neosoft.trackscanner; + +import android.app.Activity; +import android.os.Bundle; +import android.hardware.Sensor; +import android.hardware.SensorEvent; +import android.hardware.SensorEventListener; +import android.hardware.SensorManager; +import android.widget.EditText; + +public class TrackScannerActivity extends Activity implements SensorEventListener { + private SensorManager sensorManager; + private long lastUpdate; + private EditText mEdit; + private EditText mEdit2; + + /** Called when the activity is first created. */ + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); + + sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); + sensorManager.registerListener(this, + sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), + SensorManager.SENSOR_DELAY_NORMAL); + + sensorManager.registerListener(this, + sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD), + SensorManager.SENSOR_DELAY_NORMAL); + + + lastUpdate = System.currentTimeMillis(); + + mEdit = (EditText)findViewById(R.id.editText1); + mEdit2 = (EditText)findViewById(R.id.editText2); + + } + + @Override + public void onSensorChanged(SensorEvent event) { + long actualTime = System.currentTimeMillis(); + if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) { + float[] values = event.values; + // Movement + float x = values[0]; + float y = values[1]; + float z = values[2]; + + float accelerationSquareRoot = (x * x + y * y + z * z) + / (SensorManager.GRAVITY_EARTH * SensorManager.GRAVITY_EARTH); + + mEdit.setText("Accelerometer action: "+accelerationSquareRoot+ + "\nDelta: "+(actualTime-lastUpdate)+"ms"+ + "\naX: "+x+ + "\naY: "+y+ + "\naZ: "+z); + + /* + final float alpha = 0.8; + float[] linear_acceleration; + + float[] gravity; + gravity[0] = alpha * gravity[0] + (1 - alpha) * event.values[0]; + gravity[1] = alpha * gravity[1] + (1 - alpha) * event.values[1]; + gravity[2] = alpha * gravity[2] + (1 - alpha) * event.values[2]; + + linear_acceleration[0] = event.values[0] - gravity[0]; + linear_acceleration[1] = event.values[1] - gravity[1]; + linear_acceleration[2] = event.values[2] - gravity[2]; +*/ + } + + if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD) { + float[] values = event.values; + // Orientation (compass) + float x = values[0]; + float y = values[1]; + float z = values[2]; + mEdit2.setText("Magnetic Field:\n"+ + "\nX = "+x+ + "\nY = "+y+ + "\nZ = "+z ); + } + lastUpdate = actualTime; + } + + @Override + public void onAccuracyChanged(Sensor sensor, int accuracy) { + // TODO Auto-generated method stub + + } + + @Override + protected void onResume() { + super.onResume(); + // register this class as a listener for the orientation and + // accelerometer sensors + sensorManager.registerListener(this, + sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), + SensorManager.SENSOR_DELAY_NORMAL); + } + + @Override + protected void onPause() { + // unregister listener + sensorManager.unregisterListener(this); + super.onStop(); + } +} \ No newline at end of file