RedApparat / Fotoapparat

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

Detecting when camera switches #289

Open wellbranding opened 5 years ago

wellbranding commented 5 years ago

Hello, I really appreciate this library. In comparison with other libraries or default camera API, the ability to make full screen preview and get good quality picture is the best in Fotoapparat, hands down. However, one issue makes it qusteinobale to use in our project. Why Fotoapparat does not have listeners to camera states: front and back? Can something be done to add listeners, of you can't detect then camera has finally switched? Now I have to add handler with delayed 0.7 seconds to not let user see front camera and then back camera. I would spend time contributing to this, however I need more information, can't find any myself.

ksdme commented 5 years ago

It looks to me like exposing https://github.com/RedApparat/Fotoapparat/blob/master/fotoapparat/src/main/java/io/fotoapparat/Fotoapparat.kt#L221 via a PendingResult type should do the job.