Permalink
Browse files

Merge branch 'f6821462ae'

  • Loading branch information...
2 parents 15f571f + f682146 commit c81db81967a0fa689375f239e3d1fc529f1800de @cattaka committed Aug 28, 2012
Showing with 1,101 additions and 3 deletions.
  1. +28 −0 DroidDancerMotionReader/AndroidManifest.xml
  2. BIN DroidDancerMotionReader/ic_launcher-web.png
  3. BIN DroidDancerMotionReader/libs/android-support-v4.jar
  4. +20 −0 DroidDancerMotionReader/proguard-project.txt
  5. +14 −0 DroidDancerMotionReader/project.properties
  6. BIN DroidDancerMotionReader/res/drawable-hdpi/ic_action_search.png
  7. BIN DroidDancerMotionReader/res/drawable-hdpi/ic_launcher.png
  8. BIN DroidDancerMotionReader/res/drawable-ldpi/ic_launcher.png
  9. BIN DroidDancerMotionReader/res/drawable-mdpi/ic_action_search.png
  10. BIN DroidDancerMotionReader/res/drawable-mdpi/ic_launcher.png
  11. BIN DroidDancerMotionReader/res/drawable-xhdpi/ic_action_search.png
  12. BIN DroidDancerMotionReader/res/drawable-xhdpi/ic_launcher.png
  13. +15 −0 DroidDancerMotionReader/res/layout/activity_main.xml
  14. +6 −0 DroidDancerMotionReader/res/menu/activity_main.xml
  15. +7 −0 DroidDancerMotionReader/res/values-large/dimens.xml
  16. +5 −0 DroidDancerMotionReader/res/values-v11/styles.xml
  17. +5 −0 DroidDancerMotionReader/res/values-v14/styles.xml
  18. +7 −0 DroidDancerMotionReader/res/values/dimens.xml
  19. +8 −0 DroidDancerMotionReader/res/values/strings.xml
  20. +5 −0 DroidDancerMotionReader/res/values/styles.xml
  21. +110 −0 DroidDancerMotionReader/src/com/example/droiddancermotionreader/MainActivity.java
  22. +9 −0 DroidDancerMotionReader/src/com/example/droiddancermotionreader/MotionData.java
  23. +65 −0 DroidDancerMotionReader/src/com/example/droiddancermotionreader/MotionItem.java
  24. +29 −0 DroidDancerMotionWriter/AndroidManifest.xml
  25. BIN DroidDancerMotionWriter/ic_launcher-web.png
  26. BIN DroidDancerMotionWriter/libs/android-support-v4.jar
  27. +20 −0 DroidDancerMotionWriter/proguard-project.txt
  28. +14 −0 DroidDancerMotionWriter/project.properties
  29. BIN DroidDancerMotionWriter/res/drawable-hdpi/ic_action_search.png
  30. BIN DroidDancerMotionWriter/res/drawable-hdpi/ic_launcher.png
  31. BIN DroidDancerMotionWriter/res/drawable-ldpi/ic_launcher.png
  32. BIN DroidDancerMotionWriter/res/drawable-mdpi/ic_action_search.png
  33. BIN DroidDancerMotionWriter/res/drawable-mdpi/ic_launcher.png
  34. BIN DroidDancerMotionWriter/res/drawable-xhdpi/ic_action_search.png
  35. BIN DroidDancerMotionWriter/res/drawable-xhdpi/ic_launcher.png
  36. +115 −0 DroidDancerMotionWriter/res/layout/activity_edit.xml
  37. +46 −0 DroidDancerMotionWriter/res/layout/activity_main.xml
  38. +83 −0 DroidDancerMotionWriter/res/layout/list_item.xml
  39. +6 −0 DroidDancerMotionWriter/res/menu/activity_main.xml
  40. +7 −0 DroidDancerMotionWriter/res/values-large/dimens.xml
  41. +5 −0 DroidDancerMotionWriter/res/values-v11/styles.xml
  42. +5 −0 DroidDancerMotionWriter/res/values-v14/styles.xml
  43. +7 −0 DroidDancerMotionWriter/res/values/dimens.xml
  44. +8 −0 DroidDancerMotionWriter/res/values/strings.xml
  45. +5 −0 DroidDancerMotionWriter/res/values/styles.xml
  46. +70 −0 DroidDancerMotionWriter/src/jp/co/kayo/android/droiddancermotionwriter/EditActivity.java
  47. +243 −0 DroidDancerMotionWriter/src/jp/co/kayo/android/droiddancermotionwriter/MainActivity.java
  48. +65 −0 DroidDancerMotionWriter/src/jp/co/kayo/android/droiddancermotionwriter/MotionItem.java
  49. +66 −0 DroidDancerMotionWriter/src/jp/co/kayo/android/droiddancermotionwriter/MotionListAdapter.java
  50. +2 −2 DroidRobo01/.classpath
  51. +1 −1 DroidRobo01/project.properties
@@ -0,0 +1,28 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.droiddancermotionreader"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="10"
+ android:targetSdkVersion="15" />
+ <uses-permission android:name="android.permission.NFC" />
+ <uses-feature android:name="android.hardware.nfc" android:required="true" />
+
+ <application
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/title_activity_main"
+ android:launchMode="singleTop" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
@@ -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 *;
+#}
@@ -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-16
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,15 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" >
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerHorizontal="true"
+ android:layout_centerVertical="true"
+ android:padding="@dimen/padding_medium"
+ android:text="@string/hello_world"
+ tools:context=".MainActivity" />
+
+</RelativeLayout>
@@ -0,0 +1,6 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/menu_settings"
+ android:title="@string/menu_settings"
+ android:orderInCategory="100"
+ android:showAsAction="never" />
+</menu>
@@ -0,0 +1,7 @@
+<resources>
+
+ <dimen name="padding_small">8dp</dimen>
+ <dimen name="padding_medium">16dp</dimen>
+ <dimen name="padding_large">16dp</dimen>
+
+</resources>
@@ -0,0 +1,5 @@
+<resources>
+
+ <style name="AppTheme" parent="android:Theme.Holo.Light" />
+
+</resources>
@@ -0,0 +1,5 @@
+<resources>
+
+ <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar" />
+
+</resources>
@@ -0,0 +1,7 @@
+<resources>
+
+ <dimen name="padding_small">8dp</dimen>
+ <dimen name="padding_medium">8dp</dimen>
+ <dimen name="padding_large">16dp</dimen>
+
+</resources>
@@ -0,0 +1,8 @@
+<resources>
+
+ <string name="app_name">DroidDancerMotionReader</string>
+ <string name="hello_world">Hello world!</string>
+ <string name="menu_settings">Settings</string>
+ <string name="title_activity_main">MainActivity</string>
+
+</resources>
@@ -0,0 +1,5 @@
+<resources>
+
+ <style name="AppTheme" parent="android:Theme.Light" />
+
+</resources>
@@ -0,0 +1,110 @@
+package com.example.droiddancermotionreader;
+
+import java.util.List;
+
+import android.nfc.NdefMessage;
+import android.nfc.NdefRecord;
+import android.nfc.NfcAdapter;
+import android.nfc.Tag;
+import android.nfc.tech.Ndef;
+import android.nfc.tech.NdefFormatable;
+import android.os.Bundle;
+import android.os.Parcelable;
+import android.app.Activity;
+import android.app.PendingIntent;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.support.v4.app.NavUtils;
+
+public class MainActivity extends Activity {
+ private static final String TAG = "DroidDancerMotionReader";
+ private NfcAdapter nfcadapter;
+ private IntentFilter[] nfcfilters = new IntentFilter[] {
+ new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED)
+ };
+ private String[][] nfctechLists = new String[][] {
+ new String[] {
+ Ndef.class.getName()
+ }
+ };
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ nfcadapter = NfcAdapter.getDefaultAdapter(this);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.activity_main, menu);
+ return true;
+ }
+
+ @Override
+ protected void onNewIntent(Intent intent) {
+ super.onNewIntent(intent);
+ String action = intent.getAction();
+ if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)) {
+ Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
+ NdefMessage[] msgs;
+ Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
+ if (rawMsgs != null) {
+ msgs = new NdefMessage[rawMsgs.length];
+ for (int i = 0; i < rawMsgs.length; i++) {
+ msgs[i] = (NdefMessage) rawMsgs[i];
+ }
+ readNdefMessages(tag, msgs);
+ }
+ }
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ nfcadapter.disableForegroundDispatch(this);
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, new Intent(this,
+ getClass()), 0);
+ nfcadapter.enableForegroundDispatch(this, pendingIntent, nfcfilters, nfctechLists);
+ }
+
+ private MotionData readNdefMessages(Tag tag, NdefMessage[] msgs) {
+ MotionData motiondata = new MotionData();
+ for(NdefMessage msg : msgs){
+ NdefRecord rec = msg.getRecords()[0];
+ byte[] data = rec.getPayload();
+ motiondata.repeat = Byte.valueOf(data[0]);
+ int size = Byte.valueOf(data[1]);
+ Log.d(TAG, "repeat="+Byte.valueOf(motiondata.repeat).toString());
+ Log.d(TAG, "size"+size);
+ int pos=2;
+ for(int i=0; i<size; i++){
+ MotionItem item = new MotionItem();
+ item.setLed(data[pos++]==1);
+ item.setArmleft(data[pos++]);
+ item.setArmright(data[pos++]);
+ item.setRotleft(data[pos++]);
+ item.setRotright(data[pos++]);
+ item.setTime(data[pos++]);
+ motiondata.items.add(item);
+ Log.d(TAG, "led="+item.isLed());
+ Log.d(TAG, "armleft="+Byte.valueOf(item.getArmleft()).toString());
+ Log.d(TAG, "armright="+Byte.valueOf(item.getArmright()).toString());
+ Log.d(TAG, "rotleft="+Byte.valueOf(item.getRotleft()).toString());
+ Log.d(TAG, "rotright="+Byte.valueOf(item.getRotright()).toString());
+ Log.d(TAG, "time="+Byte.valueOf(item.getTime()).toString());
+
+ }
+ }
+ return motiondata;
+ }
+
+}
@@ -0,0 +1,9 @@
+package com.example.droiddancermotionreader;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MotionData {
+ byte repeat;
+ List<MotionItem> items = new ArrayList<MotionItem>();
+}
@@ -0,0 +1,65 @@
+package com.example.droiddancermotionreader;
+
+import java.util.Random;
+
+public class MotionItem {
+ private static Random _rand = new Random(System.nanoTime());
+ private long uid;
+ private boolean led;
+ private byte armleft;
+ private byte armright;
+ private byte rotleft;
+ private byte rotright;
+ private byte time;
+
+ public MotionItem(){
+ uid = _rand.nextLong();
+ }
+
+ public long getUid() {
+ return uid;
+ }
+
+ public void setUid(long uid) {
+ this.uid = uid;
+ }
+
+ public boolean isLed() {
+ return led;
+ }
+ public void setLed(boolean led) {
+ this.led = led;
+ }
+ public byte getArmleft() {
+ return armleft;
+ }
+ public void setArmleft(byte armleft) {
+ this.armleft = armleft;
+ }
+ public byte getArmright() {
+ return armright;
+ }
+ public void setArmright(byte armright) {
+ this.armright = armright;
+ }
+ public byte getRotleft() {
+ return rotleft;
+ }
+ public void setRotleft(byte rotleft) {
+ this.rotleft = rotleft;
+ }
+ public byte getRotright() {
+ return rotright;
+ }
+ public void setRotright(byte rotright) {
+ this.rotright = rotright;
+ }
+ public byte getTime() {
+ return time;
+ }
+ public void setTime(byte time) {
+ this.time = time;
+ }
+
+
+}
@@ -0,0 +1,29 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="jp.co.kayo.android.droiddancermotionwriter"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="14"
+ android:targetSdkVersion="15" />
+ <uses-permission android:name="android.permission.NFC" />
+ <uses-feature android:name="android.hardware.nfc" android:required="true" />
+
+ <application
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/title_activity_main"
+ android:launchMode="singleTop" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity android:name=".EditActivity"></activity>
+ </application>
+
+</manifest>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
@@ -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 *;
+#}
@@ -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-16
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.

0 comments on commit c81db81

Please sign in to comment.