// Path: mvvmapp/src/main/java/com/hibrianlee/mvvmapp/activity/ViewModelActivity.java
// public abstract class ViewModelActivity extends AppCompatActivity {
// 
//     private static final String EXTRA_VIEW_MODEL_STATE = "viewModelState";
// 
//     private ActivityComponent activityComponent;
//     private ViewModel viewModel;
// 
//     protected void inject(AppComponent appComponent) {
//         appComponent.inject(this);
//     }
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
// 
//         AppComponent appComponent = ((MvvmApplication) getApplication()).getAppComponent();
//         inject(appComponent);
// 
//         activityComponent = DaggerActivityComponent.builder()
//                 .appComponent(appComponent)
//                 .activityModule(new ActivityModule(this))
//                 .build();
// 
//         ViewModel.State savedViewModelState = null;
//         if (savedInstanceState != null) {
//             savedViewModelState = savedInstanceState.getParcelable(EXTRA_VIEW_MODEL_STATE);
//         }
//         viewModel = createViewModel(savedViewModelState);
//     }
// 
//     @Nullable
//     protected ViewModel createViewModel(@Nullable ViewModel.State savedViewModelState) {
//         return null;
//     }
// 
//     @Override
//     protected void onStart() {
//         super.onStart();
//         if (viewModel != null) {
//             viewModel.onStart();
//         }
//     }
// 
//     @Override
//     protected void onSaveInstanceState(Bundle outState) {
//         super.onSaveInstanceState(outState);
//         if (viewModel != null) {
//             outState.putParcelable(EXTRA_VIEW_MODEL_STATE, viewModel.getInstanceState());
//         }
//     }
// 
//     @Override
//     protected void onStop() {
//         super.onStop();
//         if (viewModel != null) {
//             viewModel.onStop();
//         }
//     }
// 
//     public final ActivityComponent getActivityComponent() {
//         return activityComponent;
//     }
// }
// 
// Path: mvvmapp/src/main/java/com/hibrianlee/mvvmapp/inject/AppComponent.java
// public interface AppComponent {
// 
//     @AppContext
//     Context appContext();
// 
//     void inject(ViewModelActivity viewModelActivity);
// 
//     void inject(ViewModelFragment viewModelFragment);
// }
// 
// Path: sample/src/main/java/com/hibrianlee/sample/mvvm/SampleAppComponent.java
// @Singleton
// @Component(modules = {
//         AppContextModule.class,
//         SampleAppModule.class
// })
// public interface SampleAppComponent extends AppComponent {
// 
//     void inject(BaseActivity baseActivity);
// 
//     void inject(BaseFragment baseFragment);
// }
// 
// Path: sample/src/main/java/com/hibrianlee/sample/mvvm/viewmodel/ViewModelFactory.java
// public interface ViewModelFactory {
// 
//     @NonNull
//     MainViewModel createMainViewModel(@NonNull ActivityComponent activityComponent,
//                                       @Nullable ViewModel.State savedViewModelState);
//     @NonNull
//     ClickCountViewModel createClickCountViewModel(@NonNull ActivityComponent activityComponent,
//                                                   @Nullable ViewModel.State savedViewModelState);
// 
//     @NonNull
//     AndroidVersionsViewModel createAndroidVersionsViewModel(
//             @NonNull AndroidVersionsAdapter adapter,
//             @NonNull ActivityComponent activityComponent,
//             @Nullable ViewModel.State savedViewModelState);
// 
//     @NonNull
//     AndroidVersionItemViewModel createAndroidVersionItemViewModel(
//             @NonNull ActivityComponent activityComponent);
// }


import com.hibrianlee.mvvmapp.activity.ViewModelActivity;
import com.hibrianlee.mvvmapp.inject.AppComponent;
import com.hibrianlee.sample.mvvm.SampleAppComponent;
import com.hibrianlee.sample.mvvm.viewmodel.ViewModelFactory;
import javax.inject.Inject;
/*
 * Copyright (C) 2015 Brian Lee (@hiBrianLee)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.hibrianlee.sample.mvvm.activity;



public class BaseActivity extends ViewModelActivity {

    @Inject
    protected ViewModelFactory viewModelFactory;

    @Override
// Path: mvvmapp/src/main/java/com/hibrianlee/mvvmapp/activity/ViewModelActivity.java
// public abstract class ViewModelActivity extends AppCompatActivity {
// 
//     private static final String EXTRA_VIEW_MODEL_STATE = "viewModelState";
// 
//     private ActivityComponent activityComponent;
//     private ViewModel viewModel;
// 
//     protected void inject(AppComponent appComponent) {
//         appComponent.inject(this);
//     }
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
// 
//         AppComponent appComponent = ((MvvmApplication) getApplication()).getAppComponent();
//         inject(appComponent);
// 
//         activityComponent = DaggerActivityComponent.builder()
//                 .appComponent(appComponent)
//                 .activityModule(new ActivityModule(this))
//                 .build();
// 
//         ViewModel.State savedViewModelState = null;
//         if (savedInstanceState != null) {
//             savedViewModelState = savedInstanceState.getParcelable(EXTRA_VIEW_MODEL_STATE);
//         }
//         viewModel = createViewModel(savedViewModelState);
//     }
// 
//     @Nullable
//     protected ViewModel createViewModel(@Nullable ViewModel.State savedViewModelState) {
//         return null;
//     }
// 
//     @Override
//     protected void onStart() {
//         super.onStart();
//         if (viewModel != null) {
//             viewModel.onStart();
//         }
//     }
// 
//     @Override
//     protected void onSaveInstanceState(Bundle outState) {
//         super.onSaveInstanceState(outState);
//         if (viewModel != null) {
//             outState.putParcelable(EXTRA_VIEW_MODEL_STATE, viewModel.getInstanceState());
//         }
//     }
// 
//     @Override
//     protected void onStop() {
//         super.onStop();
//         if (viewModel != null) {
//             viewModel.onStop();
//         }
//     }
// 
//     public final ActivityComponent getActivityComponent() {
//         return activityComponent;
//     }
// }
// 
// Path: mvvmapp/src/main/java/com/hibrianlee/mvvmapp/inject/AppComponent.java
// public interface AppComponent {
// 
//     @AppContext
//     Context appContext();
// 
//     void inject(ViewModelActivity viewModelActivity);
// 
//     void inject(ViewModelFragment viewModelFragment);
// }
// 
// Path: sample/src/main/java/com/hibrianlee/sample/mvvm/SampleAppComponent.java
// @Singleton
// @Component(modules = {
//         AppContextModule.class,
//         SampleAppModule.class
// })
// public interface SampleAppComponent extends AppComponent {
// 
//     void inject(BaseActivity baseActivity);
// 
//     void inject(BaseFragment baseFragment);
// }
// 
// Path: sample/src/main/java/com/hibrianlee/sample/mvvm/viewmodel/ViewModelFactory.java
// public interface ViewModelFactory {
// 
//     @NonNull
//     MainViewModel createMainViewModel(@NonNull ActivityComponent activityComponent,
//                                       @Nullable ViewModel.State savedViewModelState);
//     @NonNull
//     ClickCountViewModel createClickCountViewModel(@NonNull ActivityComponent activityComponent,
//                                                   @Nullable ViewModel.State savedViewModelState);
// 
//     @NonNull
//     AndroidVersionsViewModel createAndroidVersionsViewModel(
//             @NonNull AndroidVersionsAdapter adapter,
//             @NonNull ActivityComponent activityComponent,
//             @Nullable ViewModel.State savedViewModelState);
// 
//     @NonNull
//     AndroidVersionItemViewModel createAndroidVersionItemViewModel(
//             @NonNull ActivityComponent activityComponent);
// }


// Path: sample/src/main/java/com/hibrianlee/sample/mvvm/activity/BaseActivity.java
import com.hibrianlee.mvvmapp.activity.ViewModelActivity;
import com.hibrianlee.mvvmapp.inject.AppComponent;
import com.hibrianlee.sample.mvvm.SampleAppComponent;
import com.hibrianlee.sample.mvvm.viewmodel.ViewModelFactory;
import javax.inject.Inject;

/*
 * Copyright (C) 2015 Brian Lee (@hiBrianLee)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.hibrianlee.sample.mvvm.activity;



public class BaseActivity extends ViewModelActivity {

    @Inject
    protected ViewModelFactory viewModelFactory;

    @Override
    protected void inject(AppComponent appComponent) {