diff options
author | Size43 | 2015-04-23 16:50:24 +0200 |
---|---|---|
committer | Size43 | 2015-04-23 16:50:24 +0200 |
commit | 4ec27f9b29ea7653069f996c02b40ad2c0bb2226 (patch) | |
tree | 01ae80ace90c34f3edc8975b202ce2384c97dd5a /app/src/main | |
parent | BoardLoader added (diff) | |
parent | iml files (diff) |
Merge branch 'master' of https://github.com/camilstaps/RushHourAndroid
Diffstat (limited to 'app/src/main')
-rwxr-xr-x | app/src/main/java/com/camilstaps/rushhour/FullscreenActivity.java | 15 | ||||
-rw-r--r-- | app/src/main/res/raw/cantmove.wav | bin | 0 -> 325838 bytes | |||
-rw-r--r-- | app/src/main/res/raw/rushhourtune.mp3 | bin | 0 -> 879456 bytes | |||
-rw-r--r-- | app/src/main/res/raw/tune.wav | bin | 0 -> 879488 bytes |
4 files changed, 8 insertions, 7 deletions
diff --git a/app/src/main/java/com/camilstaps/rushhour/FullscreenActivity.java b/app/src/main/java/com/camilstaps/rushhour/FullscreenActivity.java index b39cddc..29b74ac 100755 --- a/app/src/main/java/com/camilstaps/rushhour/FullscreenActivity.java +++ b/app/src/main/java/com/camilstaps/rushhour/FullscreenActivity.java @@ -25,8 +25,7 @@ import java.io.InputStream; public class FullscreenActivity extends Activity { private SoundPool soundPool; - private boolean soundBackgroundLoaded = false; - private int soundBackgroundId; + private int soundBackgroundId, soundCarDriveId; @Override protected void onCreate(Bundle savedInstanceState) { @@ -56,10 +55,14 @@ public class FullscreenActivity extends Activity { soundPool.setOnLoadCompleteListener(new SoundPool.OnLoadCompleteListener() { @Override public void onLoadComplete(SoundPool soundPool, int sampleId, int status) { - soundBackgroundLoaded = true; + Log.d("FA", "Loaded: " + sampleId); + if (sampleId == soundBackgroundId) { + soundPool.play(soundBackgroundId, 1, 1, 2, -1, 1); + } } }); - soundBackgroundId = soundPool.load(this, R.raw.car_drive, 1); + soundCarDriveId = soundPool.load(this, R.raw.car_drive, 1); + soundBackgroundId = soundPool.load(this, R.raw.tune, 2); final RelativeLayout boardLayout = (RelativeLayout) findViewById(R.id.board); ViewTreeObserver vto = boardLayout.getViewTreeObserver(); @@ -74,9 +77,7 @@ public class FullscreenActivity extends Activity { board.setDriveListener(new DriveListener() { @Override public void onDrive() { - if (soundBackgroundLoaded) { - soundPool.play(soundBackgroundId, 1, 1, 1, 0, 1f); - } + soundPool.play(soundCarDriveId, 1, 1, 1, 0, 1); } }); } diff --git a/app/src/main/res/raw/cantmove.wav b/app/src/main/res/raw/cantmove.wav Binary files differnew file mode 100644 index 0000000..71e13e6 --- /dev/null +++ b/app/src/main/res/raw/cantmove.wav diff --git a/app/src/main/res/raw/rushhourtune.mp3 b/app/src/main/res/raw/rushhourtune.mp3 Binary files differnew file mode 100644 index 0000000..a11c342 --- /dev/null +++ b/app/src/main/res/raw/rushhourtune.mp3 diff --git a/app/src/main/res/raw/tune.wav b/app/src/main/res/raw/tune.wav Binary files differnew file mode 100644 index 0000000..42b5a42 --- /dev/null +++ b/app/src/main/res/raw/tune.wav |