RedApparat / Fotoapparat

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

Determine current lens position #257

Closed pflammertsma closed 6 years ago

pflammertsma commented 6 years ago

I'm migrating to Fotoapparat 2, and in dropping the obsolete FotoapparatSwitcher, I'm a bit puzzled how to determine what the current configuration is for the selected camera. A simple use case is to switch back and forth between front and rear cameras, but I must be overlooking something.

I've looked at the current parameters, but lens position isn't provided there:

fotoapparat?.getCurrentParameters()?.whenAvailable { ... }

It seems from the source that the configuration is stored in Device, but briefly trying to follow through, I didn't spot how it's exposed through the SDK.

Using Fotoapparat 2.2.0.

Diolor commented 6 years ago

Firstly sorry for the late reply. Secondly, not sure where you are puzzled but we have in the example two separate configurations which we are setting when swapping cameras

Check: https://github.com/RedApparat/Fotoapparat/blob/master/sample/src/main/java/io/fotoapparat/sample/MainActivity.kt#L177