Search in sources :

Example 1 with RequiresActivityViewModel

use of com.kickstarter.libs.qualifiers.RequiresActivityViewModel in project android-oss by kickstarter.

the class BaseActivity method assignViewModel.

private void assignViewModel(@Nullable final Bundle viewModelEnvelope) {
    if (viewModel == null) {
        final RequiresActivityViewModel annotation = getClass().getAnnotation(RequiresActivityViewModel.class);
        final Class<ViewModelType> viewModelClass = annotation == null ? null : (Class<ViewModelType>) annotation.value();
        if (viewModelClass != null) {
            viewModel = ActivityViewModelManager.getInstance().fetch(this, viewModelClass, BundleUtils.maybeGetBundle(viewModelEnvelope, VIEW_MODEL_KEY));
        }
    }
}
Also used : RequiresActivityViewModel(com.kickstarter.libs.qualifiers.RequiresActivityViewModel)

Aggregations

RequiresActivityViewModel (com.kickstarter.libs.qualifiers.RequiresActivityViewModel)1