aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/com/camilstaps/rushhour/GamePlayActivity.java
diff options
context:
space:
mode:
authorCamil Staps2015-04-29 12:56:33 +0200
committerCamil Staps2015-04-29 12:56:33 +0200
commit28eb6a408045971d79b379ac5ef408cf6b84ecbd (patch)
tree366de8d3fa2bff7ecdd0d947aba3178750854523 /app/src/main/java/com/camilstaps/rushhour/GamePlayActivity.java
parentcode license (diff)
Cleanup; victory sound
Diffstat (limited to 'app/src/main/java/com/camilstaps/rushhour/GamePlayActivity.java')
-rwxr-xr-xapp/src/main/java/com/camilstaps/rushhour/GamePlayActivity.java26
1 files changed, 2 insertions, 24 deletions
diff --git a/app/src/main/java/com/camilstaps/rushhour/GamePlayActivity.java b/app/src/main/java/com/camilstaps/rushhour/GamePlayActivity.java
index c5740b3..8399446 100755
--- a/app/src/main/java/com/camilstaps/rushhour/GamePlayActivity.java
+++ b/app/src/main/java/com/camilstaps/rushhour/GamePlayActivity.java
@@ -31,9 +31,6 @@ import java.io.InputStream;
public class GamePlayActivity extends Activity implements Board.SolveListener {
- private SoundPool soundPool;
- private int soundBackgroundId, soundCarDriveId, soundCantMoveId;
-
Board board;
boolean isFirstTime = true;
@@ -44,7 +41,6 @@ public class GamePlayActivity extends Activity implements Board.SolveListener {
setContentView(R.layout.activity_fullscreen);
- setupSoundPool();
setupBoard();
}
@@ -76,12 +72,12 @@ public class GamePlayActivity extends Activity implements Board.SolveListener {
board.setDriveListener(new DriveListener() {
@Override
public void onDrive() {
- soundPool.play(soundCarDriveId, 1, 1, 1, 0, 1);
+ TheSoundPool.getSoundPool(getBaseContext()).play(TheSoundPool.soundCarDriveId, 1, 1, 1, 0, 1);
}
@Override
public void onBlocked() {
- soundPool.play(soundCantMoveId, 1, 1, 1, 0, 1);
+ TheSoundPool.getSoundPool(getBaseContext()).play(TheSoundPool.soundCantMoveId, 1, 1, 1, 0, 1);
}
});
@@ -98,24 +94,6 @@ public class GamePlayActivity extends Activity implements Board.SolveListener {
}
}
- /**
- * Load sounds; start background music
- */
- protected void setupSoundPool() {
- soundPool = new SoundPool(2, AudioManager.STREAM_MUSIC, 0);
- soundPool.setOnLoadCompleteListener(new SoundPool.OnLoadCompleteListener() {
- @Override
- public void onLoadComplete(SoundPool soundPool, int sampleId, int status) {
- if (sampleId == soundBackgroundId) {
- soundPool.play(soundBackgroundId, 1, 1, 2, -1, 1);
- }
- }
- });
- soundBackgroundId = soundPool.load(this, R.raw.tune, 2);
- soundCarDriveId = soundPool.load(this, R.raw.car_drive, 1);
- soundCantMoveId = soundPool.load(this, R.raw.cantmove, 1);
- }
-
@Override
public void onSolve(int score) {
Intent intent = new Intent(this, FinishedActivity.class);