Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/** Represents Module for Test Management
* @author Aveek
* @author www.myproject.com
* @version 1
* @since 4.4.0 - Version
*/
@Module
internal class TestModule (val context : TestManagement) {
/**
* provides viewModel of the XML
* @param repository is containing the Repository instance which we need to call api from viewmodel
* @return Instance of ViewModel
*
* Since ViewModelProviders only accepts non-zero argument as parameter
* we had to make a Factory method to override the default behavior and accepts repository as @param
*/
@Provides
@ActivityScope
fun viewModel(repository: CustomRepository): TestManagementVM = ViewModelProviders.of(context, TestManagementVMFactory(repository)).get(TestManagementVM::class.java)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment