Navigation Menu

Skip to content

Commit

Permalink
Merge branch 'devel' into turbo
Browse files Browse the repository at this point in the history
Conflicts:
	src/cz/gug/hackathon/mantattan/MainActivity.java
	src/cz/gug/hackathon/mantattan/MusicService.java
  • Loading branch information
Jan Zalsky committed Feb 19, 2012
2 parents 98b20e5 + 789d65f commit 20231d2
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 103 deletions.
2 changes: 1 addition & 1 deletion AndroidManifest.xml
Expand Up @@ -33,7 +33,7 @@

</activity>

<service android:name=".MusicService"></service>

</application>

</manifest>
Binary file removed assets/theme.ogg
Binary file not shown.
53 changes: 50 additions & 3 deletions src/cz/gug/hackathon/mantattan/MainActivity.java
Expand Up @@ -2,7 +2,7 @@

import android.app.Activity;
import android.content.Intent;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
Expand All @@ -13,13 +13,18 @@ public class MainActivity extends Activity {

//private static final String TAG = MainActivity.class.getSimpleName();
//private DataTable dataTable;

private MediaPlayer mp ;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
this.setVolumeControlStream(AudioManager.STREAM_MUSIC);

mp = MediaPlayer.create(getApplicationContext(), R.raw.theme);
mp.start();


// dataTable = new DataTable(3, 2);
// Log.d(TAG, "====================================================");
// dataTable.shuffle(0);
Expand Down Expand Up @@ -47,4 +52,46 @@ public void onClick(View v) {


}

@Override
protected void onResume() {
mp = MediaPlayer.create(getApplicationContext(), R.raw.theme);
if (!mp.isPlaying()){
mp.start();
}

super.onResume();
}

@Override
protected void onStart() {

if (!mp.isPlaying()){
mp.start();
}

super.onStart();
}

@Override
protected void onPause() {

if (mp.isPlaying()){
mp.stop();
}

super.onPause();
}

@Override
protected void onStop() {

if (mp.isPlaying()){
mp.stop();
}

super.onStop();
}


}
97 changes: 0 additions & 97 deletions src/cz/gug/hackathon/mantattan/MusicService.java

This file was deleted.

4 changes: 2 additions & 2 deletions src/cz/gug/hackathon/mantattan/WeedCrusherApp.java
Expand Up @@ -32,14 +32,14 @@ public void onCreate() { //
// this.prefs = PreferenceManager.getDefaultSharedPreferences(this);
// this.prefs.registerOnSharedPreferenceChangeListener(this);
dataTable = new DataTable(numRows, numCols);
startService(new Intent(this, MusicService.class));

Log.i(TAG, "onCreated");
}

@Override
public void onTerminate() { //
super.onTerminate();
stopService(new Intent(this, MusicService.class));

Log.i(TAG, "onTerminated");
}

Expand Down

0 comments on commit 20231d2

Please sign in to comment.