From 8c45caf5e1ba8152b1b670fa5108905571ebdaf0 Mon Sep 17 00:00:00 2001 From: Eric Chang Date: Fri, 15 Jan 2021 16:45:51 -0800 Subject: [PATCH] Rename some usages of ViewModelInject to HiltViewModel RELNOTES=n/a PiperOrigin-RevId: 352108269 --- .../lifecycle/HiltViewModelFactory.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/java/dagger/hilt/android/internal/lifecycle/HiltViewModelFactory.java b/java/dagger/hilt/android/internal/lifecycle/HiltViewModelFactory.java index a47611d9195..e274df659ac 100644 --- a/java/dagger/hilt/android/internal/lifecycle/HiltViewModelFactory.java +++ b/java/dagger/hilt/android/internal/lifecycle/HiltViewModelFactory.java @@ -62,19 +62,19 @@ interface ViewModelModule { Map hiltViewModelMap(); } - private final Set viewModelInjectKeys; + private final Set hiltViewModelKeys; private final ViewModelProvider.Factory delegateFactory; - private final AbstractSavedStateViewModelFactory viewModelInjectFactory; + private final AbstractSavedStateViewModelFactory hiltViewModelFactory; public HiltViewModelFactory( @NonNull SavedStateRegistryOwner owner, @Nullable Bundle defaultArgs, - @NonNull Set viewModelInjectKeys, + @NonNull Set hiltViewModelKeys, @NonNull ViewModelProvider.Factory delegateFactory, @NonNull ViewModelComponentBuilder viewModelComponentBuilder) { - this.viewModelInjectKeys = viewModelInjectKeys; + this.hiltViewModelKeys = hiltViewModelKeys; this.delegateFactory = delegateFactory; - this.viewModelInjectFactory = + this.hiltViewModelFactory = new AbstractSavedStateViewModelFactory(owner, defaultArgs) { @NonNull @Override @@ -89,10 +89,10 @@ protected T create( .get(modelClass.getName()); if (provider == null) { throw new IllegalStateException( - "Expected the @ViewModelInject-annotated class '" + "Expected the @HiltViewModel-annotated class '" + modelClass.getName() + "' to be available in the multi-binding of " - + "@ViewModelInjectMap but none was found."); + + "@HiltViewModelMap but none was found."); } return (T) provider.get(); } @@ -102,8 +102,8 @@ protected T create( @NonNull @Override public T create(@NonNull Class modelClass) { - if (viewModelInjectKeys.contains(modelClass.getName())) { - return viewModelInjectFactory.create(modelClass); + if (hiltViewModelKeys.contains(modelClass.getName())) { + return hiltViewModelFactory.create(modelClass); } else { return delegateFactory.create(modelClass); }