show shutter animation along with sound
This commit is contained in:
parent
375bce1163
commit
ac3044f52b
|
@ -432,8 +432,6 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
|
|||
toggleBottomButtons(true)
|
||||
change_resolution.isEnabled = true
|
||||
mPreview?.tryTakePicture()
|
||||
shutter_animation.alpha = 1.0f
|
||||
shutter_animation.animate().alpha(0f).setDuration(CAPTURE_ANIMATION_DURATION).start()
|
||||
} else {
|
||||
mPreview?.toggleRecording()
|
||||
}
|
||||
|
@ -648,6 +646,11 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
|
|||
}
|
||||
}
|
||||
|
||||
override fun shutterAnimation() {
|
||||
shutter_animation.alpha = 1.0f
|
||||
shutter_animation.animate().alpha(0f).setDuration(CAPTURE_ANIMATION_DURATION).start()
|
||||
}
|
||||
|
||||
override fun onMediaSaved(uri: Uri) {
|
||||
change_resolution.isEnabled = true
|
||||
loadLastTakenMedia(uri)
|
||||
|
|
|
@ -423,6 +423,7 @@ class CameraXPreview(
|
|||
val mediaOutput = mediaOutputHelper.getImageMediaOutput()
|
||||
imageCapture.takePicture(mainExecutor, object : OnImageCapturedCallback() {
|
||||
override fun onCaptureSuccess(image: ImageProxy) {
|
||||
listener.shutterAnimation()
|
||||
playShutterSoundIfEnabled()
|
||||
ensureBackgroundThread {
|
||||
image.use {
|
||||
|
|
|
@ -10,6 +10,7 @@ interface CameraXPreviewListener {
|
|||
fun setFlashAvailable(available: Boolean)
|
||||
fun onChangeCamera(frontCamera: Boolean)
|
||||
fun toggleBottomButtons(hide: Boolean)
|
||||
fun shutterAnimation()
|
||||
fun onMediaSaved(uri: Uri)
|
||||
fun onImageCaptured(bitmap: Bitmap)
|
||||
fun onChangeFlashMode(flashMode: Int)
|
||||
|
|
Loading…
Reference in New Issue