// Path: app/src/main/java/pt/passarola/App.java
// public class App extends Application implements Daggerable {
// 
//     private ObjectGraph objectGraph;
// 
// 
//     public static App obtain(Context context) {
//         return (App) context.getApplicationContext();
//     }
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         Fabric.with(this, new Crashlytics());
//         buildDebugOptions();
//         buildObjectGraph();
//     }
// 
//     @Override
//     public void inject(Object object) {
//         objectGraph.inject(object);
//     }
// 
//     @Override
//     public void inject(Object object, Object... modules) {
//         objectGraph.plus(modules).inject(object);
//     }
// 
//     private void buildObjectGraph() {
//         objectGraph = ObjectGraph.create(getModules().toArray());
//         objectGraph.inject(this);
//     }
// 
//     private List<Object> getModules() {
//         return Arrays.<Object>asList(new AppModule(this));
//     }
// 
//     private void buildDebugOptions() {
//         if (BuildConfig.DEBUG) {
//             RestApi.DEBUG = true;
//             Timber.plant(new Timber.DebugTree());
//         }
//     }
// 
// }


import pt.passarola.App;
import android.os.Bundle;
import android.support.v4.app.Fragment;
package pt.passarola.services.dagger;

/**
 * Created by ruigoncalo on 31/10/15.
 */


public class DaggerableFragment extends Fragment implements Daggerable {

    @Override public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        inject(this);
    }

    @Override
    public void inject(Object object) {
        App.obtain(getActivity()).inject(object);
    }

    @Override public void inject(Object object, Object... modules) {
// Path: app/src/main/java/pt/passarola/App.java
// public class App extends Application implements Daggerable {
// 
//     private ObjectGraph objectGraph;
// 
// 
//     public static App obtain(Context context) {
//         return (App) context.getApplicationContext();
//     }
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         Fabric.with(this, new Crashlytics());
//         buildDebugOptions();
//         buildObjectGraph();
//     }
// 
//     @Override
//     public void inject(Object object) {
//         objectGraph.inject(object);
//     }
// 
//     @Override
//     public void inject(Object object, Object... modules) {
//         objectGraph.plus(modules).inject(object);
//     }
// 
//     private void buildObjectGraph() {
//         objectGraph = ObjectGraph.create(getModules().toArray());
//         objectGraph.inject(this);
//     }
// 
//     private List<Object> getModules() {
//         return Arrays.<Object>asList(new AppModule(this));
//     }
// 
//     private void buildDebugOptions() {
//         if (BuildConfig.DEBUG) {
//             RestApi.DEBUG = true;
//             Timber.plant(new Timber.DebugTree());
//         }
//     }
// 
// }


// Path: app/src/main/java/pt/passarola/services/dagger/DaggerableFragment.java
import pt.passarola.App;
import android.os.Bundle;
import android.support.v4.app.Fragment;

package pt.passarola.services.dagger;

/**
 * Created by ruigoncalo on 31/10/15.
 */


public class DaggerableFragment extends Fragment implements Daggerable {

    @Override public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        inject(this);
    }

    @Override
    public void inject(Object object) {
        App.obtain(getActivity()).inject(object);
    }

    @Override public void inject(Object object, Object... modules) {
        App.obtain(getActivity()).inject(object, modules);