-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Torkild Retvedt
authored and
Torkild Retvedt
committed
Sep 21, 2010
0 parents
commit 92b66b8
Showing
12 changed files
with
170 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?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="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>Trommelyd</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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="no.trommelyd.android" | ||
android:versionCode="1" android:versionName="0.1"> | ||
<application android:icon="@drawable/icon" android:label="@string/app_name"> | ||
<activity android:name=".trommelyd" | ||
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> | ||
<uses-sdk android:minSdkVersion="3" /> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
# "build.properties", and override values to adapt the script to your | ||
# project structure. | ||
|
||
# Project target. | ||
target=android-3 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item | ||
android:state_focused="true" | ||
android:state_pressed="false" | ||
android:drawable="@drawable/tromme_pre" /> | ||
<item | ||
android:state_focused="true" | ||
android:state_pressed="true" | ||
android:drawable="@drawable/tromme_post" /> | ||
<item | ||
android:state_focused="false" | ||
android:state_pressed="true" | ||
android:drawable="@drawable/tromme_post" /> | ||
<item | ||
android:drawable="@drawable/tromme_pre" /> | ||
</selector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="fill_parent" | ||
android:layout_height="fill_parent" | ||
android:background="#6a6a6a"> | ||
|
||
<ImageView | ||
android:id="@+id/TrommelydButton" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:src="@drawable/trommebutton" | ||
android:layout_centerInParent="true" | ||
android:clickable="true" /> | ||
</RelativeLayout> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
|
||
<string name="app_name">Trommelyd</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package no.trommelyd.android; | ||
|
||
import android.app.Activity; | ||
import android.media.MediaPlayer; | ||
import android.media.MediaPlayer.OnCompletionListener; | ||
import android.media.MediaPlayer.OnPreparedListener; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.view.Window; | ||
import android.view.View.OnClickListener; | ||
import android.widget.ImageView; | ||
|
||
public class trommelyd extends Activity { | ||
|
||
private volatile MediaPlayer trommelydPlayer; | ||
|
||
// Event handler for button click | ||
private OnClickListener trommelydButtonListener = new OnClickListener() { | ||
public void onClick(View v) { | ||
if (trommelydPlayer.isPlaying()) { | ||
trommelydPlayer.seekTo(0); | ||
} else { | ||
trommelydPlayer.start(); | ||
} | ||
} | ||
}; | ||
|
||
/** Called when the activity is first created. */ | ||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
//Remove title bar | ||
this.requestWindowFeature(Window.FEATURE_NO_TITLE); | ||
//Remove notification bar | ||
//this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); | ||
|
||
// main layout | ||
setContentView(R.layout.main); | ||
|
||
// Capture our button from layout | ||
ImageView trommelydButton = (ImageView)findViewById(R.id.TrommelydButton); | ||
|
||
// Register the onClick listener with the implementation above | ||
if (trommelydButton != null) | ||
trommelydButton.setOnClickListener(trommelydButtonListener); | ||
|
||
trommelydPlayer = MediaPlayer.create(getBaseContext(), R.raw.trommelyd); | ||
|
||
// when playback is complete, prepare for next play | ||
trommelydPlayer.setOnCompletionListener(new OnCompletionListener() { | ||
@Override | ||
public void onCompletion(MediaPlayer mp) { | ||
mp.stop(); | ||
mp.prepareAsync(); | ||
} | ||
}); | ||
|
||
// when media is prepared, make sure position is correct | ||
trommelydPlayer.setOnPreparedListener(new OnPreparedListener() { | ||
@Override | ||
public void onPrepared(MediaPlayer mp) { | ||
mp.seekTo(0); | ||
} | ||
}); | ||
} | ||
|
||
} |