This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val scopeMainActivity= ScopeSet(named<MainActivity>()).apply { | |
viewModel { (activity: Actitivty) -> | |
val data = activity.intent.getStringExtra("DATA") | |
MainViewModel(MainViewState(), data) | |
} | |
} | |
class MainActivity : BaseActivity<MainViewModel, MainViewState, ActivityMainBinding>(), MainView { | |
override var viewModelFactory: MainViewModelFactory = MainViewModelFactory(Provider { | |
currentScope.viewModel( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class App : Application() { | |
override fun onCreate() { | |
super.onCreate() | |
startKoin { | |
androidContext(this@App) | |
modules( | |
listOf( | |
applicationModule, | |
interactorModule, | |
activityModule, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val applicationModule = module { | |
... | |
} | |
val activityModule = module { | |
declareScope(scopeMainActivity) | |
... | |
} | |
val interactorModule = module { | |
factory { SomeInteractor(get()) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainViewModelFactory constructor( | |
override val viewModelProvider: Provider<MainViewModel> | |
) : BaseViewModelFactory<MainViewModel>() { | |
override val viewModelClass = MainViewModel::class | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : BaseActivity<MainViewModel, MainViewState, ActivityMainBinding>(), MainView { | |
override var viewModelFactory: MainViewModelFactory = MainViewModelFactory(Provider { | |
currentScope.viewModel(this, MainViewModel::class).value | |
}) | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainViewModelFactory @Inject constructor( | |
override val viewModelProvider: Provider<MainViewModel> | |
) : BaseViewModelFactory<MainViewModel>() { | |
override val viewModelClass = MainViewModel::class | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : BaseActivity<MainViewModel, MainViewState, ActivityMainBinding>(), MainView { | |
@Inject override lateinit var viewModelFactory: MainViewModelFactory | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class App : Application() { | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class App : DaggerApplication() { | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class BaseBindingFragment<VM : BaseViewModel<VS>, VS : ViewState, B : ViewDataBinding> : | |
BindingViewModelFragment<VM, VS, B>() { | |
override val brViewModelVariableId = BR.viewModel | |
override val brViewStateVariableId = BR.viewState | |
override val brViewVariableId = BR.view | |
} |
NewerOlder