I tried using the FotoApparat Setup, and stumbled upon some problems.
In the java configuration
Fotoapparat .with(context) .into(cameraView) // view which will draw the camera preview .previewScaleType(ScaleType.CENTER_CROP) // we want the preview to fill the view .photoSize(ResolutionSelectorsKt.highestResolution()) // we want to have the biggest photo possible .lensPosition(LensPositionSelectorsKt.back()) // we want back camera .focusMode(SelectorsKt.firstAvailable( // (optional) use the first focus mode which is supported by device FocusModeSelectorsKt. continuousFocusPicture(), FocusModeSelectorsKt.autoFocus(), // in case if continuous focus is not available on device, auto focus will be used FocusModeSelectorsKt.fixed() // if even auto focus is not available - fixed focus mode will be used )) .flash(SelectorsKt.firstAvailable( // (optional) similar to how it is done for focus mode, this time for flash FlashSelectorsKt.autoRedEye(), FlashSelectorsKt.autoFlash(), FlashSelectorsKt.torch() )) .frameProcessor(myFrameProcessor) // (optional) receives each frame from preview stream .logger(LoggersKt.loggers( // (optional) we want to log camera events in 2 places at once LoggersKt.logcat(), // ... in logcat LoggersKt.fileLogger(this) // ... and to file )) .build();
I tried using the FotoApparat Setup, and stumbled upon some problems.
In the java configuration
Fotoapparat .with(context) .into(cameraView) // view which will draw the camera preview .previewScaleType(ScaleType.CENTER_CROP) // we want the preview to fill the view .photoSize(ResolutionSelectorsKt.highestResolution()) // we want to have the biggest photo possible .lensPosition(LensPositionSelectorsKt.back()) // we want back camera .focusMode(SelectorsKt.firstAvailable( // (optional) use the first focus mode which is supported by device FocusModeSelectorsKt. continuousFocusPicture(), FocusModeSelectorsKt.autoFocus(), // in case if continuous focus is not available on device, auto focus will be used FocusModeSelectorsKt.fixed() // if even auto focus is not available - fixed focus mode will be used )) .flash(SelectorsKt.firstAvailable( // (optional) similar to how it is done for focus mode, this time for flash FlashSelectorsKt.autoRedEye(), FlashSelectorsKt.autoFlash(), FlashSelectorsKt.torch() )) .frameProcessor(myFrameProcessor) // (optional) receives each frame from preview stream .logger(LoggersKt.loggers( // (optional) we want to log camera events in 2 places at once LoggersKt.logcat(), // ... in logcat LoggersKt.fileLogger(this) // ... and to file )) .build();
you are using Kotlin parameters.
should be
.photoResolution(ResolutionSelectorsKt.highestResolution())
and so should
.previewScaleType(ScaleType.CENTER_CROP)
be
.previewScaleType(ScaleType.CenterCrop)