// Path: mvvmapp/src/main/java/com/hibrianlee/mvvmapp/inject/ActivityComponent.java
// @PerActivity
// @Component(
//         dependencies = AppComponent.class,
//         modules = {ActivityModule.class})
// public interface ActivityComponent {
// 
//     void inject(ViewModel viewModel);
// }
// 
// Path: mvvmapp/src/main/java/com/hibrianlee/mvvmapp/viewmodel/ViewModel.java
// public abstract class ViewModel extends BaseObservable {
// 
//     @Inject
//     @AppContext
//     protected Context appContext;
// 
//     @Inject
//     protected AttachedActivity attachedActivity;
// 
//     protected ViewModel(@NonNull ActivityComponent activityComponent,
//                         @Nullable State savedInstanceState) {
//         activityComponent.inject(this);
//     }
// 
//     @CallSuper
//     public void onStart() {
// 
//     }
// 
//     public State getInstanceState() {
//         return new State(this);
//     }
// 
//     @CallSuper
//     public void onStop() {
// 
//     }
// 
//     public static class State implements Parcelable {
// 
//         protected State(ViewModel viewModel) {
// 
//         }
// 
//         public State(Parcel in) {
// 
//         }
// 
//         @Override
//         public int describeContents() {
//             return 0;
//         }
// 
//         @CallSuper
//         @Override
//         public void writeToParcel(Parcel dest, int flags) {
// 
//         }
// 
//         public static Creator<State> CREATOR = new Creator<State>() {
//             @Override
//             public State createFromParcel(Parcel source) {
//                 return new State(source);
//             }
// 
//             @Override
//             public State[] newArray(int size) {
//                 return new State[size];
//             }
//         };
//     }
// }
// 
// Path: sample/src/main/java/com/hibrianlee/sample/mvvm/adapter/AndroidVersionsAdapter.java
// public class AndroidVersionsAdapter
//         extends RecyclerViewAdapter<AndroidVersion, AndroidVersionItemViewModel> {
// 
//     private final ViewModelFactory viewModelFactory;
// 
//     public AndroidVersionsAdapter(ViewModelFactory viewModelFactory,
//                                   @NonNull ActivityComponent activityComponent) {
//         super(activityComponent);
//         this.viewModelFactory = viewModelFactory;
//     }
// 
//     @Override
//     public AndroidVersionViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//         View itemView = LayoutInflater.from(parent.getContext())
//                 .inflate(R.layout.item_android_version, parent, false);
// 
//         AndroidVersionItemViewModel viewModel =
//                 viewModelFactory.createAndroidVersionItemViewModel(getActivityComponent());
// 
//         ItemAndroidVersionBinding binding = ItemAndroidVersionBinding.bind(itemView);
//         binding.setViewModel(viewModel);
// 
//         return new AndroidVersionViewHolder(itemView, binding, viewModel);
//     }
// 
//     public void setItems(ArrayList<AndroidVersion> newItems) {
//         items.clear();
//         items.addAll(newItems);
//         notifyDataSetChanged();
//     }
// 
//     public ArrayList<AndroidVersion> getItems() {
//         return items;
//     }
// 
//     static class AndroidVersionViewHolder
//             extends ItemViewHolder<AndroidVersion, AndroidVersionItemViewModel> {
// 
//         public AndroidVersionViewHolder(View itemView, ViewDataBinding binding,
//                                         AndroidVersionItemViewModel viewModel) {
//             super(itemView, binding, viewModel);
//             ButterKnife.bind(this, itemView);
//         }
// 
//         @OnClick(R.id.versionItem)
//         void onClickVersionItem() {
//             viewModel.onClick();
//         }
//     }
// }


import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.hibrianlee.mvvmapp.inject.ActivityComponent;
import com.hibrianlee.mvvmapp.viewmodel.ViewModel;
import com.hibrianlee.sample.mvvm.adapter.AndroidVersionsAdapter;
import javax.inject.Inject;
import javax.inject.Singleton;
/*
 * 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.viewmodel;




@Singleton
public class AppViewModelFactory implements ViewModelFactory {

    @Inject
    AppViewModelFactory() {

    }

    @NonNull
    @Override
    public MainViewModel createMainViewModel(@NonNull ActivityComponent activityComponent,
// Path: mvvmapp/src/main/java/com/hibrianlee/mvvmapp/inject/ActivityComponent.java
// @PerActivity
// @Component(
//         dependencies = AppComponent.class,
//         modules = {ActivityModule.class})
// public interface ActivityComponent {
// 
//     void inject(ViewModel viewModel);
// }
// 
// Path: mvvmapp/src/main/java/com/hibrianlee/mvvmapp/viewmodel/ViewModel.java
// public abstract class ViewModel extends BaseObservable {
// 
//     @Inject
//     @AppContext
//     protected Context appContext;
// 
//     @Inject
//     protected AttachedActivity attachedActivity;
// 
//     protected ViewModel(@NonNull ActivityComponent activityComponent,
//                         @Nullable State savedInstanceState) {
//         activityComponent.inject(this);
//     }
// 
//     @CallSuper
//     public void onStart() {
// 
//     }
// 
//     public State getInstanceState() {
//         return new State(this);
//     }
// 
//     @CallSuper
//     public void onStop() {
// 
//     }
// 
//     public static class State implements Parcelable {
// 
//         protected State(ViewModel viewModel) {
// 
//         }
// 
//         public State(Parcel in) {
// 
//         }
// 
//         @Override
//         public int describeContents() {
//             return 0;
//         }
// 
//         @CallSuper
//         @Override
//         public void writeToParcel(Parcel dest, int flags) {
// 
//         }
// 
//         public static Creator<State> CREATOR = new Creator<State>() {
//             @Override
//             public State createFromParcel(Parcel source) {
//                 return new State(source);
//             }
// 
//             @Override
//             public State[] newArray(int size) {
//                 return new State[size];
//             }
//         };
//     }
// }
// 
// Path: sample/src/main/java/com/hibrianlee/sample/mvvm/adapter/AndroidVersionsAdapter.java
// public class AndroidVersionsAdapter
//         extends RecyclerViewAdapter<AndroidVersion, AndroidVersionItemViewModel> {
// 
//     private final ViewModelFactory viewModelFactory;
// 
//     public AndroidVersionsAdapter(ViewModelFactory viewModelFactory,
//                                   @NonNull ActivityComponent activityComponent) {
//         super(activityComponent);
//         this.viewModelFactory = viewModelFactory;
//     }
// 
//     @Override
//     public AndroidVersionViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//         View itemView = LayoutInflater.from(parent.getContext())
//                 .inflate(R.layout.item_android_version, parent, false);
// 
//         AndroidVersionItemViewModel viewModel =
//                 viewModelFactory.createAndroidVersionItemViewModel(getActivityComponent());
// 
//         ItemAndroidVersionBinding binding = ItemAndroidVersionBinding.bind(itemView);
//         binding.setViewModel(viewModel);
// 
//         return new AndroidVersionViewHolder(itemView, binding, viewModel);
//     }
// 
//     public void setItems(ArrayList<AndroidVersion> newItems) {
//         items.clear();
//         items.addAll(newItems);
//         notifyDataSetChanged();
//     }
// 
//     public ArrayList<AndroidVersion> getItems() {
//         return items;
//     }
// 
//     static class AndroidVersionViewHolder
//             extends ItemViewHolder<AndroidVersion, AndroidVersionItemViewModel> {
// 
//         public AndroidVersionViewHolder(View itemView, ViewDataBinding binding,
//                                         AndroidVersionItemViewModel viewModel) {
//             super(itemView, binding, viewModel);
//             ButterKnife.bind(this, itemView);
//         }
// 
//         @OnClick(R.id.versionItem)
//         void onClickVersionItem() {
//             viewModel.onClick();
//         }
//     }
// }


// Path: sample/src/main/java/com/hibrianlee/sample/mvvm/viewmodel/AppViewModelFactory.java
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.hibrianlee.mvvmapp.inject.ActivityComponent;
import com.hibrianlee.mvvmapp.viewmodel.ViewModel;
import com.hibrianlee.sample.mvvm.adapter.AndroidVersionsAdapter;
import javax.inject.Inject;
import javax.inject.Singleton;

/*
 * 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.viewmodel;




@Singleton
public class AppViewModelFactory implements ViewModelFactory {

    @Inject
    AppViewModelFactory() {

    }

    @NonNull
    @Override
    public MainViewModel createMainViewModel(@NonNull ActivityComponent activityComponent,
                                             @Nullable ViewModel.State savedViewModelState) {