Making pictures capture in Android simple
Dionysis Lorentzos
977

Fotoapparat v2

A Kotlin era

Around 9 months ago we made our git init of Fotoapparat library. Since then few things changed. We faced issues, generated ideas and learned from mistakes. We also received great support from people from as little as reporting issues to PRs. Thank you all for showing us your ❤️.

Fotoapparat’s icon by Leander Lenzing

Today we decide to launch the first v2.x of Fotoapparat and we have few little nice things to share with you.


New language

Biggest addition is the pure support of Kotlin. We actually rewrote the whole library in Kotlin. Of course it still works fine with Java. We kept the Java builder structure for the ones who have still not migrated for this reason.

We want to give devs who use Kotlin the possibility of the powerful data classes’ .copy(), among other Kotlin features.

If you have selected a configuration you can partially update it with .copy(). Example:

val configuration = CameraConfiguration(
// A full configuration
// ...
)

fotoapparat.updateConfiguration(
configuration.copy(
flashMode = if (isChecked) torch() else off()
)
)

Improved camera switching

In v1 we used FotoapparatSwitcher. That was a quick solution due to great demand to switch cameras.

Now, we found few ways to improve the library structure and this can be done simply with:

fotoapparat.switchTo(
lensPosition = newLensPosition,
cameraConfiguration = newConfiguration
)

We also promise some performance improvements here since we switch only what’s needed.

More explicit exceptions

Sometimes stuff go wrong and we all need to know why.

We have seen what is more bothersome for the devs to learn and use the library so we put some extra effort for more explicit error messages.


Thanks all for the support and keep sending us feedback when you have issues!

Have a happy coding year! ❤️,

the Fotoapparat team