RedApparat / Fotoapparat

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

Add the ability to implement your own SizeSelector #44

Closed iAlex97 closed 7 years ago

iAlex97 commented 7 years ago

If you'd like to use other resolution than the provided biggestSize() and smallestSize() you can't or at least it's not documented. I'd like to do some JNI image processing and for that I need to find a sweet spot between the max and min resolutin.

dmitry-zaitsev commented 7 years ago

biggsetSize() and smallestSize() are actually returning an implementation of SelectorFunction. That is the interface which provides you with a list of available items (sizes in this case) and asks you to pick one of them.

SelectorFunction is public, so you can just provide your own implementation where you would normally call biggestSize().

Here are some examples of implementation: https://github.com/Fotoapparat/Fotoapparat/blob/master/fotoapparat/src/main/java/io/fotoapparat/parameter/selector/SizeSelectors.java