Tue, 22 Nov 2011 21:36:35 +0100
added android trackscanner project
--- /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 @@ +<?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>
--- /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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>Freeslot TrackScanner</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>
--- /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 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="de.neosoft.trackscanner" + android:versionCode="1" + android:versionName="1.0" > + + <uses-sdk android:minSdkVersion="8" /> + + <application + android:icon="@drawable/ic_launcher" + android:label="@string/app_name" > + <activity + android:label="@string/app_name" + android:name=".TrackScannerActivity" > + <intent-filter > + <action android:name="android.intent.action.MAIN" /> + + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> + +</manifest> \ No newline at end of file
--- /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; + } +}
--- /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 <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 *; +}
--- /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
--- /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 @@ +<?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/hello" /> + + <EditText + android:id="@+id/editText1" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="0.17" + android:inputType="textMultiLine" > + + <requestFocus /> + </EditText> + + <EditText + android:id="@+id/editText2" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="0.14" android:inputType="textMultiLine"/> + +</LinearLayout> \ No newline at end of file
--- /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 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <string name="hello">Hello World, TrackScannerActivity!</string> + <string name="app_name">Freeslot TrackScanner</string> + +</resources> \ No newline at end of file
--- /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