RedApparat / Fotoapparat

Making Camera for Android more friendly. 📸
Apache License 2.0
3.82k stars 405 forks source link

Suggestion: Add callback when focus is locked #153

Closed siralam closed 6 years ago

siralam commented 6 years ago

Let's say I want to play a shutter animation when the focus is locked / just before taking a picture.

I don't want to play it together with pressing the capture button because the camera needs time to lock focus.

Hope this feature will be added in the future!

Raenar4k commented 6 years ago

Hey! While there are no general callback when camera is focused, you can get callback when you are triggering focus manually:

        fotoapparat.focus().whenAvailable { result: FocusResult? -> 
            Log.d("callback test", "focus now in $result state")
        }

But that does not help when taking photos and i agree, callback could be very useful. (As a workaround you could manually focus, then take photo, while disabling auto focus which triggers by photo - but that too is not possible yet, see #149 )

Diolor commented 6 years ago

Plan is to remove the focus routine just before taking a photo (#149). Then you will be able to use the code @Raenar4k perfectly suggested.

I assume this issue solved. Will continue with #149 about takePicture/focus relation