Here is a code sample of what I am trying to do:
var shutterBuilder = Shutter.with(this)
if (useCamera) shutterBuilder = shutterBuilder.takePhoto().usePrivateAppExternalStorage()
else shutterBuilder = shutterBuilder.getPhotoFromGallery()
shutterResult = shutterBuilder
.snap(object : ShutterResultCallback {
I am trying to dynamically choose what builder I use. Depending on boolean variable useCamera.
Problem is I cannot do this because the builder objects being returned from each are not common.
What I could do:
- add a function
build() that builds to a common object that you can then call snap() on.
- Will a kotlin DSL allow me to solve this problem from a different angle?
Here is a code sample of what I am trying to do:
I am trying to dynamically choose what builder I use. Depending on boolean variable
useCamera.Problem is I cannot do this because the builder objects being returned from each are not common.
What I could do:
build()that builds to a common object that you can then callsnap()on.