Closed srserx closed 3 years ago
Found out we can use both Java and Kotlin in the same project :-)
Hi @srserx,
The AnimBuilder class is written in Kotlin, but it is still interoperable with Java so yes you can use the function like this:
StepperNavigationView stepper = findViewById(R.id.stepper);
NavController navController = ActivityKt.findNavController(this, R.id.frame_stepper);
stepper.setupWithNavController(
navController,
builder -> {
builder.setEnter(android.R.anim.fade_in);
builder.setExit(android.R.anim.fade_out);
builder.setPopEnter(android.R.anim.fade_in);
builder.setPopExit(android.R.anim.fade_out);
return Unit.INSTANCE;
}
);
I will add a @JvmOverloads
annotation to the setupWithNavController
function so you can use it with the default AnimBuilder
like:
stepper.setupWithNavController(navController);
The following code seems to be only supported by Kotlin:
as the setupWithNavController call in java asks for a second parameter, which must be an AnimBuilder. But AnimBuilder seems not to be available for Java:
Is there any workaround in order to make it work with Java as well?
Thanks a lot in advance!