Closed scifinder closed 6 years ago
Hello! =) Can you help me with migration from version 1.3.0 to 2.2.0? My code (before & after):
Part I From
import io.fotoapparat.Fotoapparat; import io.fotoapparat.parameter.update.UpdateRequest; import io.fotoapparat.photo.BitmapPhoto; import io.fotoapparat.result.PendingResult; import io.fotoapparat.result.PhotoResult; import io.fotoapparat.view.CameraView; import static io.fotoapparat.parameter.selector.AspectRatioSelectors.aspectRatio; import static io.fotoapparat.parameter.selector.FlashSelectors.off; import static io.fotoapparat.parameter.selector.FlashSelectors.on; import static io.fotoapparat.parameter.selector.Selectors.firstAvailable; import static io.fotoapparat.parameter.selector.SizeSelectors.biggestSize; import static io.fotoapparat.parameter.selector.SizeSelectors.smallestSize;
to
import io.fotoapparat.Fotoapparat; import io.fotoapparat.configuration.UpdateConfiguration; import io.fotoapparat.result.BitmapPhoto; import io.fotoapparat.result.WhenDoneListener; import io.fotoapparat.result.PhotoResult; import io.fotoapparat.view.CameraView; import kotlin.Unit; import static io.fotoapparat.selector.AspectRatioSelectorsKt.aspectRatio; import static io.fotoapparat.selector.FlashSelectorsKt.off; import static io.fotoapparat.selector.FlashSelectorsKt.on; import static io.fotoapparat.selector.SelectorsKt.firstAvailable; import static io.fotoapparat.selector.ResolutionSelectorsKt.highestResolution; import static io.fotoapparat.selector.ResolutionSelectorsKt.lowestResolution;
Part II From
photoResult.saveToFile(file) .whenAvailable(new PendingResult.Callback<Void>() { @Override public void onResult(Void t){
photoResult.saveToFile(file) .whenDone(new WhenDoneListener<Unit>() { @Override public void whenDone(Unit unit) {
And from
photoResult.toBitmap() .whenAvailable(new PendingResult.Callback<BitmapPhoto>() { @Override public void onResult(BitmapPhoto result) {
photoResult.toBitmap() .whenDone(new WhenDoneListener<BitmapPhoto>() { @Override public void whenDone(BitmapPhoto bitmapPhoto) {
Part III From
fotoapparat.updateParameters( UpdateRequest.builder() .flash( isOn ? on() : off() ).build()
fotoapparat.updateConfiguration( UpdateConfiguration.builder() .flash( isOn ? on() : off() ).build() );
It's right?
Hi @scifinder! Migrated code looks good to me 👍
Hello! =) Can you help me with migration from version 1.3.0 to 2.2.0? My code (before & after):
Part I From
to
Part II From
to
And from
to
Part III From
to
It's right?