summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2013-09-06 18:40:09 +0100
committerTim Redfern <tim@eclectronics.org>2013-09-06 18:40:09 +0100
commit65bff27967c6791dd9ee488ed425be35f515b3e0 (patch)
treeceac6ff178ac01ad4fe5e8e57ff5d90fa6ff3d47
initial commit
-rw-r--r--AndroidManifest.xml32
-rw-r--r--bin/AndroidManifest.xml32
-rw-r--r--bin/RotorM.apkbin0 -> 258236 bytes
-rw-r--r--bin/RotorM1.apkbin0 -> 258233 bytes
-rw-r--r--bin/classes.dexbin0 -> 627160 bytes
-rw-r--r--bin/classes/com/example/rotorm/BuildConfig.classbin0 -> 345 bytes
-rw-r--r--bin/classes/com/example/rotorm/MainActivity.classbin0 -> 7099 bytes
-rw-r--r--bin/classes/com/example/rotorm/R$attr.classbin0 -> 340 bytes
-rw-r--r--bin/classes/com/example/rotorm/R$dimen.classbin0 -> 461 bytes
-rw-r--r--bin/classes/com/example/rotorm/R$drawable.classbin0 -> 407 bytes
-rw-r--r--bin/classes/com/example/rotorm/R$id.classbin0 -> 431 bytes
-rw-r--r--bin/classes/com/example/rotorm/R$layout.classbin0 -> 431 bytes
-rw-r--r--bin/classes/com/example/rotorm/R$menu.classbin0 -> 388 bytes
-rw-r--r--bin/classes/com/example/rotorm/R$string.classbin0 -> 472 bytes
-rw-r--r--bin/classes/com/example/rotorm/R$style.classbin0 -> 431 bytes
-rw-r--r--bin/classes/com/example/rotorm/R.classbin0 -> 673 bytes
-rw-r--r--bin/dexedLibs/android-support-v4-9e6eb8e807572b5f217f4c6265e59ac0.jarbin0 -> 211326 bytes
-rw-r--r--bin/dexedLibs/android-support-v4-b95a6b732be9494db93a4f243ef4c509.jarbin0 -> 211326 bytes
-rw-r--r--bin/jarlist.cache3
-rw-r--r--bin/res/drawable-hdpi/ic_launcher.pngbin0 -> 5964 bytes
-rw-r--r--bin/res/drawable-mdpi/ic_launcher.pngbin0 -> 3112 bytes
-rw-r--r--bin/res/drawable-xhdpi/ic_launcher.pngbin0 -> 9355 bytes
-rw-r--r--bin/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 17889 bytes
-rw-r--r--bin/resources.ap_bin0 -> 41373 bytes
-rw-r--r--gen/com/example/rotorm/BuildConfig.java6
-rw-r--r--gen/com/example/rotorm/R.java70
-rw-r--r--ic_launcher-web.pngbin0 -> 51394 bytes
-rw-r--r--libs/android-support-v4.jarbin0 -> 556198 bytes
-rw-r--r--proguard-project.txt20
-rw-r--r--project.properties14
-rw-r--r--res/drawable-hdpi/ic_launcher.pngbin0 -> 7658 bytes
-rw-r--r--res/drawable-mdpi/ic_launcher.pngbin0 -> 3777 bytes
-rw-r--r--res/drawable-xhdpi/ic_launcher.pngbin0 -> 12516 bytes
-rw-r--r--res/drawable-xxhdpi/ic_launcher.pngbin0 -> 24777 bytes
-rw-r--r--res/layout/activity_main.xml16
-rw-r--r--res/layout/main.xml9
-rw-r--r--res/menu/main.xml9
-rw-r--r--res/values-sw600dp/dimens.xml8
-rw-r--r--res/values-sw720dp-land/dimens.xml9
-rw-r--r--res/values-v11/styles.xml11
-rw-r--r--res/values-v14/styles.xml12
-rw-r--r--res/values/dimens.xml7
-rw-r--r--res/values/strings.xml8
-rw-r--r--res/values/styles.xml20
-rw-r--r--src/com/example/rotorm/MainActivity.java259
45 files changed, 545 insertions, 0 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
new file mode 100644
index 0000000..114166c
--- /dev/null
+++ b/AndroidManifest.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.rotorm"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="17"
+ android:targetSdkVersion="17" />
+
+
+ <uses-permission android:name="android.permission.CAMERA" />
+ <uses-feature android:name="android.hardware.camera" />
+ <uses-feature android:name="android.hardware.camera.autofocus" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity
+ android:name="com.example.rotorm.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/bin/AndroidManifest.xml b/bin/AndroidManifest.xml
new file mode 100644
index 0000000..114166c
--- /dev/null
+++ b/bin/AndroidManifest.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.rotorm"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="17"
+ android:targetSdkVersion="17" />
+
+
+ <uses-permission android:name="android.permission.CAMERA" />
+ <uses-feature android:name="android.hardware.camera" />
+ <uses-feature android:name="android.hardware.camera.autofocus" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity
+ android:name="com.example.rotorm.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/bin/RotorM.apk b/bin/RotorM.apk
new file mode 100644
index 0000000..6969af7
--- /dev/null
+++ b/bin/RotorM.apk
Binary files differ
diff --git a/bin/RotorM1.apk b/bin/RotorM1.apk
new file mode 100644
index 0000000..ce2906f
--- /dev/null
+++ b/bin/RotorM1.apk
Binary files differ
diff --git a/bin/classes.dex b/bin/classes.dex
new file mode 100644
index 0000000..3ab90a9
--- /dev/null
+++ b/bin/classes.dex
Binary files differ
diff --git a/bin/classes/com/example/rotorm/BuildConfig.class b/bin/classes/com/example/rotorm/BuildConfig.class
new file mode 100644
index 0000000..0e9c261
--- /dev/null
+++ b/bin/classes/com/example/rotorm/BuildConfig.class
Binary files differ
diff --git a/bin/classes/com/example/rotorm/MainActivity.class b/bin/classes/com/example/rotorm/MainActivity.class
new file mode 100644
index 0000000..44b3a35
--- /dev/null
+++ b/bin/classes/com/example/rotorm/MainActivity.class
Binary files differ
diff --git a/bin/classes/com/example/rotorm/R$attr.class b/bin/classes/com/example/rotorm/R$attr.class
new file mode 100644
index 0000000..b91c9ba
--- /dev/null
+++ b/bin/classes/com/example/rotorm/R$attr.class
Binary files differ
diff --git a/bin/classes/com/example/rotorm/R$dimen.class b/bin/classes/com/example/rotorm/R$dimen.class
new file mode 100644
index 0000000..a9ba10a
--- /dev/null
+++ b/bin/classes/com/example/rotorm/R$dimen.class
Binary files differ
diff --git a/bin/classes/com/example/rotorm/R$drawable.class b/bin/classes/com/example/rotorm/R$drawable.class
new file mode 100644
index 0000000..8bbf9bb
--- /dev/null
+++ b/bin/classes/com/example/rotorm/R$drawable.class
Binary files differ
diff --git a/bin/classes/com/example/rotorm/R$id.class b/bin/classes/com/example/rotorm/R$id.class
new file mode 100644
index 0000000..9c7852d
--- /dev/null
+++ b/bin/classes/com/example/rotorm/R$id.class
Binary files differ
diff --git a/bin/classes/com/example/rotorm/R$layout.class b/bin/classes/com/example/rotorm/R$layout.class
new file mode 100644
index 0000000..2ba895d
--- /dev/null
+++ b/bin/classes/com/example/rotorm/R$layout.class
Binary files differ
diff --git a/bin/classes/com/example/rotorm/R$menu.class b/bin/classes/com/example/rotorm/R$menu.class
new file mode 100644
index 0000000..8fd5581
--- /dev/null
+++ b/bin/classes/com/example/rotorm/R$menu.class
Binary files differ
diff --git a/bin/classes/com/example/rotorm/R$string.class b/bin/classes/com/example/rotorm/R$string.class
new file mode 100644
index 0000000..868990e
--- /dev/null
+++ b/bin/classes/com/example/rotorm/R$string.class
Binary files differ
diff --git a/bin/classes/com/example/rotorm/R$style.class b/bin/classes/com/example/rotorm/R$style.class
new file mode 100644
index 0000000..9b41eed
--- /dev/null
+++ b/bin/classes/com/example/rotorm/R$style.class
Binary files differ
diff --git a/bin/classes/com/example/rotorm/R.class b/bin/classes/com/example/rotorm/R.class
new file mode 100644
index 0000000..c619ba5
--- /dev/null
+++ b/bin/classes/com/example/rotorm/R.class
Binary files differ
diff --git a/bin/dexedLibs/android-support-v4-9e6eb8e807572b5f217f4c6265e59ac0.jar b/bin/dexedLibs/android-support-v4-9e6eb8e807572b5f217f4c6265e59ac0.jar
new file mode 100644
index 0000000..f7620ee
--- /dev/null
+++ b/bin/dexedLibs/android-support-v4-9e6eb8e807572b5f217f4c6265e59ac0.jar
Binary files differ
diff --git a/bin/dexedLibs/android-support-v4-b95a6b732be9494db93a4f243ef4c509.jar b/bin/dexedLibs/android-support-v4-b95a6b732be9494db93a4f243ef4c509.jar
new file mode 100644
index 0000000..1be9980
--- /dev/null
+++ b/bin/dexedLibs/android-support-v4-b95a6b732be9494db93a4f243ef4c509.jar
Binary files differ
diff --git a/bin/jarlist.cache b/bin/jarlist.cache
new file mode 100644
index 0000000..0565465
--- /dev/null
+++ b/bin/jarlist.cache
@@ -0,0 +1,3 @@
+# cache for current jar dependency. DO NOT EDIT.
+# format is <lastModified> <length> <SHA-1> <path>
+# Encoding is UTF-8
diff --git a/bin/res/drawable-hdpi/ic_launcher.png b/bin/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..efa7c5f
--- /dev/null
+++ b/bin/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/bin/res/drawable-mdpi/ic_launcher.png b/bin/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..ec27f2e
--- /dev/null
+++ b/bin/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/bin/res/drawable-xhdpi/ic_launcher.png b/bin/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..92fc57d
--- /dev/null
+++ b/bin/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/bin/res/drawable-xxhdpi/ic_launcher.png b/bin/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..b6f8f4e
--- /dev/null
+++ b/bin/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/bin/resources.ap_ b/bin/resources.ap_
new file mode 100644
index 0000000..93b621a
--- /dev/null
+++ b/bin/resources.ap_
Binary files differ
diff --git a/gen/com/example/rotorm/BuildConfig.java b/gen/com/example/rotorm/BuildConfig.java
new file mode 100644
index 0000000..b14ab5f
--- /dev/null
+++ b/gen/com/example/rotorm/BuildConfig.java
@@ -0,0 +1,6 @@
+/** Automatically generated file. DO NOT MODIFY */
+package com.example.rotorm;
+
+public final class BuildConfig {
+ public final static boolean DEBUG = true;
+} \ No newline at end of file
diff --git a/gen/com/example/rotorm/R.java b/gen/com/example/rotorm/R.java
new file mode 100644
index 0000000..f070dbb
--- /dev/null
+++ b/gen/com/example/rotorm/R.java
@@ -0,0 +1,70 @@
+/* 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.example.rotorm;
+
+public final class R {
+ public static final class attr {
+ }
+ public static final class dimen {
+ /** Default screen margins, per the Android Design guidelines.
+
+ Customize dimensions originally defined in res/values/dimens.xml (such as
+ screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
+
+ */
+ public static final int activity_horizontal_margin=0x7f040000;
+ public static final int activity_vertical_margin=0x7f040001;
+ }
+ public static final class drawable {
+ public static final int ic_launcher=0x7f020000;
+ }
+ public static final class id {
+ public static final int action_settings=0x7f080001;
+ public static final int surface_camera=0x7f080000;
+ }
+ public static final class layout {
+ public static final int activity_main=0x7f030000;
+ public static final int main=0x7f030001;
+ }
+ public static final class menu {
+ public static final int main=0x7f070000;
+ }
+ public static final class string {
+ public static final int action_settings=0x7f050001;
+ public static final int app_name=0x7f050000;
+ public static final int hello_world=0x7f050002;
+ }
+ public static final class style {
+ /**
+ Base application theme, dependent on API level. This theme is replaced
+ by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+
+
+ Theme customizations available in newer API levels can go in
+ res/values-vXX/styles.xml, while customizations related to
+ backward-compatibility can go here.
+
+
+ Base application theme for API 11+. This theme completely replaces
+ AppBaseTheme from res/values/styles.xml on API 11+ devices.
+
+ API 11 theme customizations can go here.
+
+ Base application theme for API 14+. This theme completely replaces
+ AppBaseTheme from BOTH res/values/styles.xml and
+ res/values-v11/styles.xml on API 14+ devices.
+
+ API 14 theme customizations can go here.
+ */
+ public static final int AppBaseTheme=0x7f060000;
+ /** Application theme.
+ All customizations that are NOT specific to a particular API-level can go here.
+ */
+ public static final int AppTheme=0x7f060001;
+ }
+}
diff --git a/ic_launcher-web.png b/ic_launcher-web.png
new file mode 100644
index 0000000..a18cbb4
--- /dev/null
+++ b/ic_launcher-web.png
Binary files differ
diff --git a/libs/android-support-v4.jar b/libs/android-support-v4.jar
new file mode 100644
index 0000000..cf12d28
--- /dev/null
+++ b/libs/android-support-v4.jar
Binary files differ
diff --git a/proguard-project.txt b/proguard-project.txt
new file mode 100644
index 0000000..f2fe155
--- /dev/null
+++ b/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/project.properties b/project.properties
new file mode 100644
index 0000000..ce39f2d
--- /dev/null
+++ b/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-18
diff --git a/res/drawable-hdpi/ic_launcher.png b/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..288b665
--- /dev/null
+++ b/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_launcher.png b/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..6ae570b
--- /dev/null
+++ b/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_launcher.png b/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..d4fb7cd
--- /dev/null
+++ b/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_launcher.png b/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..85a6081
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/res/layout/activity_main.xml b/res/layout/activity_main.xml
new file mode 100644
index 0000000..168c9b8
--- /dev/null
+++ b/res/layout/activity_main.xml
@@ -0,0 +1,16 @@
+<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"
+ android:paddingBottom="@dimen/activity_vertical_margin"
+ android:paddingLeft="@dimen/activity_horizontal_margin"
+ android:paddingRight="@dimen/activity_horizontal_margin"
+ android:paddingTop="@dimen/activity_vertical_margin"
+ tools:context=".MainActivity" >
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/hello_world" />
+
+</RelativeLayout>
diff --git a/res/layout/main.xml b/res/layout/main.xml
new file mode 100644
index 0000000..40bfa59
--- /dev/null
+++ b/res/layout/main.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<SurfaceView android:id="@+id/surface_camera"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_centerInParent="true"
+ android:layout_weight="1"
+ >
+</SurfaceView> \ No newline at end of file
diff --git a/res/menu/main.xml b/res/menu/main.xml
new file mode 100644
index 0000000..c002028
--- /dev/null
+++ b/res/menu/main.xml
@@ -0,0 +1,9 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android" >
+
+ <item
+ android:id="@+id/action_settings"
+ android:orderInCategory="100"
+ android:showAsAction="never"
+ android:title="@string/action_settings"/>
+
+</menu>
diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml
new file mode 100644
index 0000000..44f01db
--- /dev/null
+++ b/res/values-sw600dp/dimens.xml
@@ -0,0 +1,8 @@
+<resources>
+
+ <!--
+ Customize dimensions originally defined in res/values/dimens.xml (such as
+ screen margins) for sw600dp devices (e.g. 7" tablets) here.
+ -->
+
+</resources>
diff --git a/res/values-sw720dp-land/dimens.xml b/res/values-sw720dp-land/dimens.xml
new file mode 100644
index 0000000..61e3fa8
--- /dev/null
+++ b/res/values-sw720dp-land/dimens.xml
@@ -0,0 +1,9 @@
+<resources>
+
+ <!--
+ Customize dimensions originally defined in res/values/dimens.xml (such as
+ screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
+ -->
+ <dimen name="activity_horizontal_margin">128dp</dimen>
+
+</resources>
diff --git a/res/values-v11/styles.xml b/res/values-v11/styles.xml
new file mode 100644
index 0000000..3c02242
--- /dev/null
+++ b/res/values-v11/styles.xml
@@ -0,0 +1,11 @@
+<resources>
+
+ <!--
+ Base application theme for API 11+. This theme completely replaces
+ AppBaseTheme from res/values/styles.xml on API 11+ devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
+ <!-- API 11 theme customizations can go here. -->
+ </style>
+
+</resources>
diff --git a/res/values-v14/styles.xml b/res/values-v14/styles.xml
new file mode 100644
index 0000000..a91fd03
--- /dev/null
+++ b/res/values-v14/styles.xml
@@ -0,0 +1,12 @@
+<resources>
+
+ <!--
+ Base application theme for API 14+. This theme completely replaces
+ AppBaseTheme from BOTH res/values/styles.xml and
+ res/values-v11/styles.xml on API 14+ devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+ <!-- API 14 theme customizations can go here. -->
+ </style>
+
+</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
new file mode 100644
index 0000000..55c1e59
--- /dev/null
+++ b/res/values/dimens.xml
@@ -0,0 +1,7 @@
+<resources>
+
+ <!-- Default screen margins, per the Android Design guidelines. -->
+ <dimen name="activity_horizontal_margin">16dp</dimen>
+ <dimen name="activity_vertical_margin">16dp</dimen>
+
+</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
new file mode 100644
index 0000000..69f1d0c
--- /dev/null
+++ b/res/values/strings.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <string name="app_name">RotorM</string>
+ <string name="action_settings">Settings</string>
+ <string name="hello_world">Hello world!</string>
+
+</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
new file mode 100644
index 0000000..6ce89c7
--- /dev/null
+++ b/res/values/styles.xml
@@ -0,0 +1,20 @@
+<resources>
+
+ <!--
+ Base application theme, dependent on API level. This theme is replaced
+ by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Light">
+ <!--
+ Theme customizations available in newer API levels can go in
+ res/values-vXX/styles.xml, while customizations related to
+ backward-compatibility can go here.
+ -->
+ </style>
+
+ <!-- Application theme. -->
+ <style name="AppTheme" parent="AppBaseTheme">
+ <!-- All customizations that are NOT specific to a particular API-level can go here. -->
+ </style>
+
+</resources>
diff --git a/src/com/example/rotorm/MainActivity.java b/src/com/example/rotorm/MainActivity.java
new file mode 100644
index 0000000..c88d6fd
--- /dev/null
+++ b/src/com/example/rotorm/MainActivity.java
@@ -0,0 +1,259 @@
+package com.example.rotorm;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Date;
+
+import com.example.rotorm.R;
+
+import android.hardware.Camera;
+import android.hardware.Camera.Parameters;
+import android.media.MediaPlayer;
+import android.media.MediaRecorder;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Environment;
+import android.app.Activity;
+import android.content.Intent;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.SurfaceHolder;
+import android.view.SurfaceView;
+import android.view.SurfaceHolder.Callback;
+import android.widget.Toast;
+
+public class MainActivity extends Activity implements Callback {
+
+ @Override
+ protected void onDestroy() {
+ //stopRecording();
+ super.onDestroy();
+ }
+
+ private SurfaceHolder surfaceHolder;
+ private SurfaceView surfaceView;
+ public MediaRecorder mrec = new MediaRecorder();
+ private Camera mCamera;
+ private Uri uriSound;
+ MediaPlayer mp;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ uriSound=Uri.parse("");
+
+ Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI);
+ startActivityForResult(intent, 10);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ menu.add(0, 0, 0, "Start");
+ //menu.add(0, 0, 0, "Pick audio track");
+ return super.onCreateOptionsMenu(menu);
+ // Inflate the menu; this adds items to the action bar if it is present.
+ //getMenuInflater().inflate(R.menu.main, menu);
+ //return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item)
+ {
+ if(item.getTitle().equals("Start"))
+ {
+ try {
+
+ startRecording();
+ item.setTitle("Stop");
+
+ } catch (Exception e) {
+
+ String message = e.getMessage();
+ Log.i(null, "Problem " + message);
+ mrec.release();
+ }
+
+ }
+ else if(item.getTitle().equals("Stop"))
+ {
+ mrec.stop();
+ mrec.release();
+ mrec = null;
+ item.setTitle("Start");
+ mp.stop();
+ }
+ else if(item.getTitle().equals("Pick audio track"))
+ {
+ Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI);
+ startActivityForResult(intent, 10);
+ }
+
+ return super.onOptionsItemSelected(item);
+ }
+
+ protected void startPreview() throws IOException {
+
+ //http://stackoverflow.com/questions/12098298/android-camera-app-passed-null-surface
+ if(mCamera==null) mCamera = Camera.open();
+
+ setContentView(R.layout.main);
+
+ surfaceView = (SurfaceView) findViewById(R.id.surface_camera);
+
+ surfaceHolder = surfaceView.getHolder();
+ surfaceHolder.addCallback(this);
+ surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
+
+ //mCamera.lock();
+ //mCamera.unlock();
+
+ mCamera.setPreviewDisplay(surfaceHolder);
+ mCamera.startPreview();
+
+ }
+
+ protected void startRecording() throws IOException
+ {
+ if(mCamera==null)
+ mCamera = Camera.open();
+
+ String filename;
+ String path;
+
+ path= Environment.getExternalStorageDirectory().getAbsolutePath().toString();
+
+ Date date=new Date();
+ filename="/rec"+date.toString().replace(" ", "_").replace(":", "_")+".mp4";
+
+ Log.i(null, "Saving video file: " + filename);
+
+ //create empty file it must use
+ File file=new File(path,filename);
+
+ mrec = new MediaRecorder();
+
+ mCamera.lock();
+ mCamera.unlock();
+
+ // Please maintain sequence of following code.
+
+ // If you change sequence it will not work.
+ mrec.setCamera(mCamera);
+ mrec.setVideoSource(MediaRecorder.VideoSource.CAMERA);
+ //mrec.setAudioSource(MediaRecorder.AudioSource.MIC);
+ mrec.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
+ mrec.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
+ //mrec.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
+ mrec.setPreviewDisplay(surfaceHolder.getSurface());
+ mrec.setOutputFile(path+filename);
+ mrec.prepare();
+ mrec.start();
+
+ Log.i(null, "Audio file: " + uriSound);
+
+ //try {
+ //MediaPlayer mp = new MediaPlayer();
+ //MediaPlayer mp = MediaPlayer.create(this, R.raw.stick);
+ mp = MediaPlayer.create(this, uriSound);
+ //mp.setDataSource(this, uriSound);
+ mp.start();
+ ///} catch (IllegalArgumentException e) {
+ // TODO Auto-generated catch block
+ // e.printStackTrace();
+ //} catch (SecurityException e) {
+ // TODO Auto-generated catch block
+ // e.printStackTrace();
+ //} catch (IllegalStateException e) {
+ // TODO Auto-generated catch block
+ // e.printStackTrace();
+ //} catch (IOException e) {
+ // TODO Auto-generated catch block
+ // e.printStackTrace();
+ //}
+ }
+
+ protected void stopRecording() {
+
+ if(mrec!=null)
+ {
+ mrec.stop();
+ mrec.release();
+ mCamera.release();
+ mCamera.lock();
+ }
+
+ mp.stop();
+ }
+
+ private void releaseMediaRecorder() {
+
+ if (mrec != null) {
+ mrec.reset(); // clear recorder configuration
+ mrec.release(); // release the recorder object
+ }
+ }
+
+ private void releaseCamera() {
+ if (mCamera != null) {
+ mCamera.release(); // release the camera for other applications
+ mCamera = null;
+ }
+
+ }
+
+ @Override
+ public void surfaceChanged(SurfaceHolder holder, int format, int width,int height) {
+
+ }
+
+ @Override
+ public void surfaceCreated(SurfaceHolder holder) {
+
+ if (mCamera != null) {
+ Parameters params = mCamera.getParameters();
+ mCamera.setParameters(params);
+ Log.i("Surface", "Created");
+ }
+ else {
+ Toast.makeText(getApplicationContext(), "Camera not available!",
+ Toast.LENGTH_LONG).show();
+
+ finish();
+ }
+
+ }
+
+ @Override
+ public void surfaceDestroyed(SurfaceHolder holder) {
+ mCamera.stopPreview();
+ mCamera.release();
+ //http://stackoverflow.com/questions/13235306/method-called-after-release-exception-camera-preview
+ //mCamera=null;
+ }
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+
+ //if(requestCode == RESULT_OK && requestCode == 10){
+ uriSound=data.getData();
+
+ Log.i("Sound file",uriSound.toString());
+
+ //String temp="audioFileName";
+ //this.getIntent().getStringExtra(temp);
+ //uriSound=Uri.parse(temp);
+ //uriSound=Uri.parse("/Music/stick.mp3");
+ try {
+ startPreview();
+ } catch (IOException e) {
+ Log.e("Preview","Error");
+ e.printStackTrace();
+ }
+
+ //}
+ }
+
+}