Search in sources :

Example 6 with ViewModelProviderFactory

use of com.mindorks.framework.mvvm.ViewModelProviderFactory in project android-mvvm-architecture by MindorksOpenSource.

the class ActivityModule method provideLoginViewModel.

@Provides
LoginViewModel provideLoginViewModel(DataManager dataManager, SchedulerProvider schedulerProvider) {
    Supplier<LoginViewModel> supplier = () -> new LoginViewModel(dataManager, schedulerProvider);
    ViewModelProviderFactory<LoginViewModel> factory = new ViewModelProviderFactory<>(LoginViewModel.class, supplier);
    return new ViewModelProvider(activity, factory).get(LoginViewModel.class);
}
Also used : ViewModelProviderFactory(com.mindorks.framework.mvvm.ViewModelProviderFactory) LoginViewModel(com.mindorks.framework.mvvm.ui.login.LoginViewModel) ViewModelProvider(androidx.lifecycle.ViewModelProvider) Provides(dagger.Provides)

Example 7 with ViewModelProviderFactory

use of com.mindorks.framework.mvvm.ViewModelProviderFactory in project android-mvvm-architecture by MindorksOpenSource.

the class DialogModule method provideRateUsViewModel.

@Provides
RateUsViewModel provideRateUsViewModel(DataManager dataManager, SchedulerProvider schedulerProvider) {
    Supplier<RateUsViewModel> supplier = () -> new RateUsViewModel(dataManager, schedulerProvider);
    ViewModelProviderFactory<RateUsViewModel> factory = new ViewModelProviderFactory<>(RateUsViewModel.class, supplier);
    return new ViewModelProvider(dialog.getActivity(), factory).get(RateUsViewModel.class);
}
Also used : ViewModelProviderFactory(com.mindorks.framework.mvvm.ViewModelProviderFactory) RateUsViewModel(com.mindorks.framework.mvvm.ui.main.rating.RateUsViewModel) ViewModelProvider(androidx.lifecycle.ViewModelProvider) Provides(dagger.Provides)

Example 8 with ViewModelProviderFactory

use of com.mindorks.framework.mvvm.ViewModelProviderFactory in project android-mvvm-architecture by MindorksOpenSource.

the class FragmentModule method provideOpenSourceViewModel.

@Provides
OpenSourceViewModel provideOpenSourceViewModel(DataManager dataManager, SchedulerProvider schedulerProvider) {
    Supplier<OpenSourceViewModel> supplier = () -> new OpenSourceViewModel(dataManager, schedulerProvider);
    ViewModelProviderFactory<OpenSourceViewModel> factory = new ViewModelProviderFactory<>(OpenSourceViewModel.class, supplier);
    return new ViewModelProvider(fragment, factory).get(OpenSourceViewModel.class);
}
Also used : OpenSourceViewModel(com.mindorks.framework.mvvm.ui.feed.opensource.OpenSourceViewModel) ViewModelProviderFactory(com.mindorks.framework.mvvm.ViewModelProviderFactory) ViewModelProvider(androidx.lifecycle.ViewModelProvider) Provides(dagger.Provides)

Aggregations

ViewModelProvider (androidx.lifecycle.ViewModelProvider)8 ViewModelProviderFactory (com.mindorks.framework.mvvm.ViewModelProviderFactory)8 Provides (dagger.Provides)8 AboutViewModel (com.mindorks.framework.mvvm.ui.about.AboutViewModel)1 FeedViewModel (com.mindorks.framework.mvvm.ui.feed.FeedViewModel)1 BlogViewModel (com.mindorks.framework.mvvm.ui.feed.blogs.BlogViewModel)1 OpenSourceViewModel (com.mindorks.framework.mvvm.ui.feed.opensource.OpenSourceViewModel)1 LoginViewModel (com.mindorks.framework.mvvm.ui.login.LoginViewModel)1 MainViewModel (com.mindorks.framework.mvvm.ui.main.MainViewModel)1 RateUsViewModel (com.mindorks.framework.mvvm.ui.main.rating.RateUsViewModel)1 SplashViewModel (com.mindorks.framework.mvvm.ui.splash.SplashViewModel)1