aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Palmer <felix.palmer@metaswitch.com>2011-12-02 13:29:41 -0800
committerFelix Palmer <felix.palmer@metaswitch.com>2011-12-02 13:29:41 -0800
commita92a1757e7b882e0dbb00a7c580bfa3e09255083 (patch)
treee25e7668b1c51ac3f7a8a9e465a719a101f8a837
parent80b5eeb678618b7a82a513da5d4cf480e6e1cde4 (diff)
downloadandroid_external_android-visualizer-a92a1757e7b882e0dbb00a7c580bfa3e09255083.tar.gz
android_external_android-visualizer-a92a1757e7b882e0dbb00a7c580bfa3e09255083.tar.bz2
android_external_android-visualizer-a92a1757e7b882e0dbb00a7c580bfa3e09255083.zip
Added stop/start buttons
-rw-r--r--AndroidManifest.xml4
-rw-r--r--res/layout/main.xml29
-rw-r--r--src/com/pheelicks/visualizer/VisualizerActivity.java19
3 files changed, 45 insertions, 7 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 18d24d5..2adc0e5 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -10,8 +10,10 @@
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
+ android:configChanges="orientation|keyboard|keyboardHidden"
android:label="@string/app_name"
- android:name=".VisualizerActivity" >
+ android:name=".VisualizerActivity"
+ android:screenOrientation="portrait" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
diff --git a/res/layout/main.xml b/res/layout/main.xml
index bc12cd8..83899fc 100644
--- a/res/layout/main.xml
+++ b/res/layout/main.xml
@@ -4,9 +4,34 @@
android:layout_height="fill_parent"
android:orientation="vertical" >
- <TextView
+ <FrameLayout
+ android:layout_width="fill_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1" >
+ </FrameLayout>
+
+ <LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:text="@string/hello" />
+ android:layout_weight="0" >
+
+ <Button
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_margin="10dp"
+ android:layout_weight="0.5"
+ android:onClick="startPressed"
+ android:text="Start" >
+ </Button>
+
+ <Button
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_margin="10dp"
+ android:layout_weight="0.5"
+ android:onClick="stopPressed"
+ android:text="Stop" >
+ </Button>
+ </LinearLayout>
</LinearLayout> \ No newline at end of file
diff --git a/src/com/pheelicks/visualizer/VisualizerActivity.java b/src/com/pheelicks/visualizer/VisualizerActivity.java
index b9ef300..b56be76 100644
--- a/src/com/pheelicks/visualizer/VisualizerActivity.java
+++ b/src/com/pheelicks/visualizer/VisualizerActivity.java
@@ -3,17 +3,28 @@ package com.pheelicks.visualizer;
import android.app.Activity;
import android.media.MediaPlayer;
import android.os.Bundle;
+import android.view.View;
public class VisualizerActivity extends Activity {
+ private MediaPlayer mPlayer;
+
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
- // Just play test file
- MediaPlayer player = MediaPlayer.create(this, R.raw.test);
- player.setLooping(true);
- player.start();
+ mPlayer = MediaPlayer.create(this, R.raw.test);
+ mPlayer.setLooping(true);
+ }
+
+ public void startPressed(View view)
+ {
+ mPlayer.start();
+ }
+
+ public void stopPressed(View view)
+ {
+ mPlayer.stop();
}
} \ No newline at end of file