android.arch.lifecycle.ViewModelProvider Java Examples
The following examples show how to use
android.arch.lifecycle.ViewModelProvider.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SceneViewModelProviders.java From scene with Apache License 2.0 | 6 votes |
@MainThread public static ViewModelProvider of(@NonNull Scene scene) { ViewModelProvider.AndroidViewModelFactory factory = ViewModelProvider.AndroidViewModelFactory.getInstance( checkApplication(checkActivity(scene))); return new ViewModelProvider(scene.getViewModelStore(), factory); }
Example #2
Source File: AppListFragment.java From island with Apache License 2.0 | 5 votes |
@Override public void onCreate(final @Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRetainInstance(true); // To keep view-model (by keeping the view-model provider) setHasOptionsMenu(true); final Activity activity = getActivity(); mServiceShuttleContext = new ServiceShuttleContext(activity); final ViewModelProvider provider = ViewModelProviders.of(this); mViewModel = provider.get(AppListViewModel.class); mViewModel.mFeatured = mFeaturedViewModel = provider.get(FeaturedListViewModel.class); mUserGuide = UserGuide.initializeIfNeeded(activity, this, mViewModel); IslandAppListProvider.getInstance(activity).registerObserver(mAppChangeObserver); }
Example #3
Source File: PresenterModule.java From leanback-showcase with Apache License 2.0 | 5 votes |
@PerFragment @Provides public LiveDataRowPresenter provideLiveDataRowPresenter(ViewModelProvider.Factory factory, DataLoadedListener activity) { LiveDataRowPresenter rowPresenter = new LiveDataRowPresenter(factory); rowPresenter.registerDataLoadedListener(activity); return rowPresenter; }
Example #4
Source File: LoginActivityModule.java From triviums with MIT License | 4 votes |
@Provides ViewModelProvider.Factory provideViewModelProvider(LoginActivityViewModel viewModel){ return new ViewModelProviderFactory<>(viewModel); }
Example #5
Source File: LiveDataRowPresenter.java From leanback-showcase with Apache License 2.0 | 4 votes |
public LiveDataRowPresenter(ViewModelProvider.Factory factory) { super(); mDataLoadedListeners = new ArrayList<>(); viewModelFactory = factory; }
Example #6
Source File: ViewModelModule.java From leanback-showcase with Apache License 2.0 | 4 votes |
@Binds @Singleton abstract ViewModelProvider.Factory bindViewModelFactory(ViewModelFactory factory);
Example #7
Source File: ViewModelFactoryModule.java From MVVMArms with Apache License 2.0 | 4 votes |
@Binds abstract ViewModelProvider.Factory bindViewModelFactory(ViewModelFactory factory);
Example #8
Source File: ViewModelModule.java From AndroidBlueprints with Apache License 2.0 | 4 votes |
@Binds abstract ViewModelProvider.Factory bindViewModelFactory(ViewModelFactory factory);
Example #9
Source File: ViewModelModule.java From mvvm-template with GNU General Public License v3.0 | 4 votes |
@Binds abstract ViewModelProvider.Factory bindViewModelFactory(GithubViewModelFactory factory);
Example #10
Source File: ViewModelModule.java From firestore-android-arch-components with Apache License 2.0 | 4 votes |
@Binds abstract ViewModelProvider.Factory bindViewModelFactory(ViewModelFactory factory);
Example #11
Source File: SplashScreenActivityModule.java From triviums with MIT License | 4 votes |
@Provides ViewModelProvider.Factory provideViewModelProvider(SplashScreenViewModel viewModel){ return new ViewModelProviderFactory<>(viewModel); }
Example #12
Source File: ProfileFragmentModule.java From triviums with MIT License | 4 votes |
@Provides ViewModelProvider.Factory provideViewModelProvider(ProfileViewModel viewModel){ return new ViewModelProviderFactory<>(viewModel); }
Example #13
Source File: QuestionFragmentModule.java From triviums with MIT License | 4 votes |
@Provides //@Named("QuestionFragment") ViewModelProvider.Factory provideViewModelProvider(QuestionViewModel viewModel){ return new ViewModelProviderFactory<>(viewModel); }
Example #14
Source File: StagesFragmentModule.java From triviums with MIT License | 4 votes |
@Provides ViewModelProvider.Factory provideViewModelProvider(StagesViewModel viewModel){ return new ViewModelProviderFactory<>(viewModel); }
Example #15
Source File: CategoryFragmentModule.java From triviums with MIT License | 4 votes |
@Provides ViewModelProvider.Factory provideViewModelProvider(CategoryViewModel viewModel){ return new ViewModelProviderFactory<>(viewModel); }
Example #16
Source File: LeaderboardFragmentModule.java From triviums with MIT License | 4 votes |
@Provides ViewModelProvider.Factory provideViewModelProvider(LeaderboardViewModel viewModel){ return new ViewModelProviderFactory<>(viewModel); }
Example #17
Source File: OnBoardingActivityModule.java From triviums with MIT License | 4 votes |
@Provides ViewModelProvider.Factory provideViewModelProvider(OnBoardingViewModel viewModel){ return new ViewModelProviderFactory<>(viewModel); }
Example #18
Source File: ViewModelModule.java From Dagger2-Sample with MIT License | 4 votes |
@Binds abstract ViewModelProvider.Factory bindViewModelFactory(ViewModelFactory factory);
Example #19
Source File: AppModule.java From WanAndroid with GNU General Public License v3.0 | 4 votes |
@Singleton @Binds abstract ViewModelProvider.Factory provideViewModelFactory(ProjectViewModelFactory factory);
Example #20
Source File: SceneViewModelProviders.java From scene with Apache License 2.0 | 4 votes |
@MainThread public static ViewModelProvider of(@NonNull Scene scene, @NonNull ViewModelProvider.Factory factory) { return new ViewModelProvider(scene.getViewModelStore(), factory); }
Example #21
Source File: LiveDataDetailFragmentSubComponent.java From leanback-showcase with Apache License 2.0 | votes |
ViewModelProvider.Factory viewModelProviderFactory();