diff options
-rwxr-xr-x | src/com/android/camera/CaptureUI.java | 6 | ||||
-rwxr-xr-x | src/com/android/camera/ui/CountDownView.java | 22 |
2 files changed, 12 insertions, 16 deletions
diff --git a/src/com/android/camera/CaptureUI.java b/src/com/android/camera/CaptureUI.java index 85ac9e293..c5875327d 100755 --- a/src/com/android/camera/CaptureUI.java +++ b/src/com/android/camera/CaptureUI.java @@ -1551,7 +1551,11 @@ public class CaptureUI implements FocusOverlayManager.FocusUI, } public void initCountDownView() { - if (mCountDownView == null) initializeCountDown(); + if (mCountDownView == null) { + initializeCountDown(); + } else { + mCountDownView.initSoundPool(); + } } public void releaseSoundPool() { diff --git a/src/com/android/camera/ui/CountDownView.java b/src/com/android/camera/ui/CountDownView.java index f62c99958..0e1acc080 100755 --- a/src/com/android/camera/ui/CountDownView.java +++ b/src/com/android/camera/ui/CountDownView.java @@ -55,15 +55,19 @@ public class CountDownView extends FrameLayout { mContext = context; mCountDownAnim = AnimationUtils.loadAnimation(context, R.anim.count_down_exit); + initSoundPool(); + } + + public void initSoundPool() { if (mSoundPool == null) { // Load the beeps - if (context.getResources().getBoolean(R.bool.force_count_down_sound)) { + if (mContext.getResources().getBoolean(R.bool.force_count_down_sound)) { mSoundPool = new SoundPool(1, AudioManager.STREAM_SYSTEM_ENFORCED, 0); } else { mSoundPool = new SoundPool(1, AudioManager.STREAM_NOTIFICATION, 0); } - mBeepOnce = mSoundPool.load(context, R.raw.beep_once, 1); - mBeepTwice = mSoundPool.load(context, R.raw.beep_twice, 1); + mBeepOnce = mSoundPool.load(mContext, R.raw.beep_once, 1); + mBeepTwice = mSoundPool.load(mContext, R.raw.beep_twice, 1); } } @@ -98,18 +102,6 @@ public class CountDownView extends FrameLayout { mCountDownAnim.reset(); mRemainingSecondsView.clearAnimation(); mRemainingSecondsView.startAnimation(mCountDownAnim); - - if (mSoundPool == null) { - // Load the beeps - if (mContext.getResources().getBoolean(R.bool.force_count_down_sound)) { - mSoundPool = new SoundPool(1, AudioManager.STREAM_SYSTEM_ENFORCED, 0); - } else { - mSoundPool = new SoundPool(1, AudioManager.STREAM_NOTIFICATION, 0); - } - mBeepOnce = mSoundPool.load(mContext, R.raw.beep_once, 1); - mBeepTwice = mSoundPool.load(mContext, R.raw.beep_twice, 1); - } - // Play sound effect for the last 3 seconds of the countdown if (mPlaySound && mSoundPool != null) { if (newVal == 1) { |