// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/activities/MainActivityComponent.java
// @PerActivity
// @Component(dependencies = AppComponent.class, modules = {ActivityModule.class, MainActivityModule.class})
// public interface MainActivityComponent extends MainFragment.Pluser{
//   void injectActivity(MainActivity mainActivity);
//   A provideA();
//   List<String> provideDiInjectionHistory();
//   Log4Me provideLog4Me();
// }
// 
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
// 
//   protected T fragmentComponent;
// 
//   @Override public void onCreate(Bundle savedInstanceState) {
//     super.onCreate(savedInstanceState);
//     initDIComponent();
//     setRetainInstance(true);
//   }
// 
//   public T getFragmentComponent() {
//     return fragmentComponent;
//   }
// 
//   protected abstract void initDIComponent();
// 
//   /**
//    * Gets a component for dependency injection by its type.
//    */
//   protected <C> C getParentComponent(Class<C> componentType) {
//     return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
//   }
// 
// }
// 
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
//   BaseFragment baseFragment;
// 
//   public FragmentModule(BaseFragment baseFragment) {
//     this.baseFragment = baseFragment;
//   }
// }
// 
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
// 
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/B.java
// public class B {}
// 
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/C.java
// public class C {}
// 
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
// 
//   @Inject
//   public D() {
// 
//   }
// 
// }


import me.martinez.sergio.daggertwobasearchitecture.test.D;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.activities.MainActivityComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.test.B;
import me.martinez.sergio.daggertwobasearchitecture.test.C;
/*
 *  Copyright (C) 2015 Sergio Martinez Open Source Project
 *
 *  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 me.martinez.sergio.daggertwobasearchitecture.fragments;


/**
 * Created by Sergio Martinez Rodriguez
 * Date 15/7/15.
 */
public class MainFragment extends BaseFragment<MainFragmentComponent> {

  @Inject B b;
  @Inject A a;
  @Inject C c;
  @Inject List<String> diInjectioHistoric;

  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    return inflater.inflate(R.layout.fragment_main, container, false);
  }

  @Override public void onStart() {
    super.onStart();
    testDI();
  }

  private void testDI() {
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/activities/MainActivityComponent.java
// @PerActivity
// @Component(dependencies = AppComponent.class, modules = {ActivityModule.class, MainActivityModule.class})
// public interface MainActivityComponent extends MainFragment.Pluser{
//   void injectActivity(MainActivity mainActivity);
//   A provideA();
//   List<String> provideDiInjectionHistory();
//   Log4Me provideLog4Me();
// }
// 
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
// 
//   protected T fragmentComponent;
// 
//   @Override public void onCreate(Bundle savedInstanceState) {
//     super.onCreate(savedInstanceState);
//     initDIComponent();
//     setRetainInstance(true);
//   }
// 
//   public T getFragmentComponent() {
//     return fragmentComponent;
//   }
// 
//   protected abstract void initDIComponent();
// 
//   /**
//    * Gets a component for dependency injection by its type.
//    */
//   protected <C> C getParentComponent(Class<C> componentType) {
//     return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
//   }
// 
// }
// 
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
//   BaseFragment baseFragment;
// 
//   public FragmentModule(BaseFragment baseFragment) {
//     this.baseFragment = baseFragment;
//   }
// }
// 
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
// 
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/B.java
// public class B {}
// 
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/C.java
// public class C {}
// 
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
// 
//   @Inject
//   public D() {
// 
//   }
// 
// }


// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/MainFragment.java
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.activities.MainActivityComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.test.B;
import me.martinez.sergio.daggertwobasearchitecture.test.C;

/*
 *  Copyright (C) 2015 Sergio Martinez Open Source Project
 *
 *  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 me.martinez.sergio.daggertwobasearchitecture.fragments;


/**
 * Created by Sergio Martinez Rodriguez
 * Date 15/7/15.
 */
public class MainFragment extends BaseFragment<MainFragmentComponent> {

  @Inject B b;
  @Inject A a;
  @Inject C c;
  @Inject List<String> diInjectioHistoric;

  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    return inflater.inflate(R.layout.fragment_main, container, false);
  }

  @Override public void onStart() {
    super.onStart();
    testDI();
  }

  private void testDI() {
    diInjectioHistoric.add(MainFragment.class.getName());