mirror of
https://github.com/SimpleMobileTools/Simple-Camera.git
synced 2025-04-25 04:28:46 +02:00
catch exceptions thrown by takePicture
This commit is contained in:
parent
bc2eb5e80d
commit
78949bb0a8
@ -283,15 +283,18 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
|
|||||||
mCamera!!.parameters = mParameters
|
mCamera!!.parameters = mParameters
|
||||||
isWaitingForTakePictureCallback = true
|
isWaitingForTakePictureCallback = true
|
||||||
mIsPreviewShown = true
|
mIsPreviewShown = true
|
||||||
mCamera!!.takePicture(null, null, takePictureCallback)
|
try {
|
||||||
|
mCamera!!.takePicture(null, null, takePictureCallback)
|
||||||
|
|
||||||
if (config.isSoundEnabled) {
|
if (config.isSoundEnabled) {
|
||||||
val audioManager = context.getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
val audioManager = context.getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
||||||
val volume = audioManager.getStreamVolume(AudioManager.STREAM_SYSTEM)
|
val volume = audioManager.getStreamVolume(AudioManager.STREAM_SYSTEM)
|
||||||
if (volume != 0) {
|
if (volume != 0) {
|
||||||
val mp = MediaPlayer.create(context, Uri.parse("file:///system/media/audio/ui/camera_click.ogg"))
|
val mp = MediaPlayer.create(context, Uri.parse("file:///system/media/audio/ui/camera_click.ogg"))
|
||||||
mp?.start()
|
mp?.start()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (ignored: Exception) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mCanTakePicture = false
|
mCanTakePicture = false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user