please checkout https://github.com/willhaben/MultiStackScreenFlow
A non fragment approach
to use Screenflow, your Activity need to inherit from ScreenflowActivity:
class MainActivity : ScreenFlowActivity() {
override fun getLayoutId(): Int = R.layout.screenflow
override fun provideContentFrameForScreenFlow(): FrameLayout = screenflow_content
override fun getInitialScreenClass(): Class<out Screen> = GithubJobSearchScreen::class.java
override fun setDataForInitialScreen(screen: Screen) {
}
override fun exit() {
finish()
}
}
inherit from Screen to simply manage your state variables
class ScreenA(screenFlow: ScreenFlow) : Screen(...) {
//foo must be either primitive type or implement parcelable or serializable
var foo by state(null)
var lazyFoo by lazyState{ Foo() }
var lateInitFoo by lateInitState<Foo>()
//do things with foo
...