// Path: napkin/src/main/java/com/github/aleksandermielczarek/napkin/ComponentProvider.java
// public interface ComponentProvider<T> {
// 
//     T provideComponent();
// }
// 
// Path: napkin/src/main/java/com/github/aleksandermielczarek/napkin/Napkin.java
// public class Napkin {
// 
//     private Napkin() {
// 
//     }
// 
//     @SuppressWarnings("unchecked")
//     public static <T> T provideComponent(Object object) {
//         ComponentProvider<T> componentProvider = (ComponentProvider<T>) object;
//         return componentProvider.provideComponent();
//     }
// 
//     public static <T> T provideAppComponent(Context context) {
//         Context application = context.getApplicationContext();
//         return provideComponent(application);
//     }
// 
//     public static <T> T provideAppComponent(Fragment fragment) {
//         Context context = fragment.getContext();
//         return provideAppComponent(context);
//     }
// 
//     public static <T> T provideAppComponent(View view) {
//         Context context = view.getContext();
//         return provideAppComponent(context);
//     }
// 
//     public static <T> T provideActivityComponent(Fragment fragment) {
//         Context activity = fragment.getActivity();
//         return provideComponent(activity);
//     }
// 
//     public static <T> T provideActivityComponent(View view) {
//         Context activity = view.getContext();
//         return provideComponent(activity);
//     }
// }
// 
// Path: app/src/main/java/com/github/aleksandermielczarek/napkinexample/component/ActivityComponent.java
// @ActivityScope
// @Subcomponent(modules = ActivityModule.class)
// public interface ActivityComponent {
// 
//     FragmentComponent with(FragmentModule fragmentModule);
// 
//     void inject(MainActivity mainActivity);
// }
// 
// Path: app/src/main/java/com/github/aleksandermielczarek/napkinexample/component/AppComponent.java
// @Component(modules = AppModule.class)
// @AppScope
// public interface AppComponent {
// 
//     ActivityComponent with(ActivityModule activityModule);
// }
// 
// Path: app/src/main/java/com/github/aleksandermielczarek/napkinexample/module/ActivityModule.java
// @Module
// @ActivityScope
// public class ActivityModule extends NapkinActivityModule {
// 
//     public ActivityModule(AppCompatActivity activity) {
//         super(activity);
//     }
// 
//     @Provides
//     @ActivityString
//     String provideNapkinString() {
//         return "Hello Napkin in Activity!";
//     }
// }


import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import com.github.aleksandermielczarek.napkin.ComponentProvider;
import com.github.aleksandermielczarek.napkin.Napkin;
import com.github.aleksandermielczarek.napkinexample.R;
import com.github.aleksandermielczarek.napkinexample.component.ActivityComponent;
import com.github.aleksandermielczarek.napkinexample.component.AppComponent;
import com.github.aleksandermielczarek.napkinexample.databinding.ActivityMainBinding;
import com.github.aleksandermielczarek.napkinexample.module.ActivityModule;
import javax.inject.Inject;
package com.github.aleksandermielczarek.napkinexample.ui;




/**
 * Created by Aleksander Mielczarek on 13.05.2016.
 */
public class MainActivity extends AppCompatActivity implements ComponentProvider<ActivityComponent> {

    @Inject
    protected MainViewModel mainViewModel;

    private ActivityComponent activityComponent;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        activityComponent = Napkin.<AppComponent>provideAppComponent(this)
                .with(new ActivityModule(this));

// Path: napkin/src/main/java/com/github/aleksandermielczarek/napkin/ComponentProvider.java
// public interface ComponentProvider<T> {
// 
//     T provideComponent();
// }
// 
// Path: napkin/src/main/java/com/github/aleksandermielczarek/napkin/Napkin.java
// public class Napkin {
// 
//     private Napkin() {
// 
//     }
// 
//     @SuppressWarnings("unchecked")
//     public static <T> T provideComponent(Object object) {
//         ComponentProvider<T> componentProvider = (ComponentProvider<T>) object;
//         return componentProvider.provideComponent();
//     }
// 
//     public static <T> T provideAppComponent(Context context) {
//         Context application = context.getApplicationContext();
//         return provideComponent(application);
//     }
// 
//     public static <T> T provideAppComponent(Fragment fragment) {
//         Context context = fragment.getContext();
//         return provideAppComponent(context);
//     }
// 
//     public static <T> T provideAppComponent(View view) {
//         Context context = view.getContext();
//         return provideAppComponent(context);
//     }
// 
//     public static <T> T provideActivityComponent(Fragment fragment) {
//         Context activity = fragment.getActivity();
//         return provideComponent(activity);
//     }
// 
//     public static <T> T provideActivityComponent(View view) {
//         Context activity = view.getContext();
//         return provideComponent(activity);
//     }
// }
// 
// Path: app/src/main/java/com/github/aleksandermielczarek/napkinexample/component/ActivityComponent.java
// @ActivityScope
// @Subcomponent(modules = ActivityModule.class)
// public interface ActivityComponent {
// 
//     FragmentComponent with(FragmentModule fragmentModule);
// 
//     void inject(MainActivity mainActivity);
// }
// 
// Path: app/src/main/java/com/github/aleksandermielczarek/napkinexample/component/AppComponent.java
// @Component(modules = AppModule.class)
// @AppScope
// public interface AppComponent {
// 
//     ActivityComponent with(ActivityModule activityModule);
// }
// 
// Path: app/src/main/java/com/github/aleksandermielczarek/napkinexample/module/ActivityModule.java
// @Module
// @ActivityScope
// public class ActivityModule extends NapkinActivityModule {
// 
//     public ActivityModule(AppCompatActivity activity) {
//         super(activity);
//     }
// 
//     @Provides
//     @ActivityString
//     String provideNapkinString() {
//         return "Hello Napkin in Activity!";
//     }
// }


// Path: app/src/main/java/com/github/aleksandermielczarek/napkinexample/ui/MainActivity.java
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import com.github.aleksandermielczarek.napkin.ComponentProvider;
import com.github.aleksandermielczarek.napkin.Napkin;
import com.github.aleksandermielczarek.napkinexample.R;
import com.github.aleksandermielczarek.napkinexample.component.ActivityComponent;
import com.github.aleksandermielczarek.napkinexample.component.AppComponent;
import com.github.aleksandermielczarek.napkinexample.databinding.ActivityMainBinding;
import com.github.aleksandermielczarek.napkinexample.module.ActivityModule;
import javax.inject.Inject;

package com.github.aleksandermielczarek.napkinexample.ui;




/**
 * Created by Aleksander Mielczarek on 13.05.2016.
 */
public class MainActivity extends AppCompatActivity implements ComponentProvider<ActivityComponent> {

    @Inject
    protected MainViewModel mainViewModel;

    private ActivityComponent activityComponent;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        activityComponent = Napkin.<AppComponent>provideAppComponent(this)
                .with(new ActivityModule(this));

        activityComponent.inject(this);