// Path: app/src/main/java/com/sefford/material/sample/common/ui/activities/BaseActivity.java
// public abstract class BaseActivity extends Activity {
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         final ObjectGraph originalGraph = ((MaterialApplication) getApplication()).getGraph();
//         extend(originalGraph, getExtensions(originalGraph, getIntent().getExtras())).inject(this);
//     }
// 
//     /**
//      * Extends and returns the ObjectGraph with ad-hoc extensions or returns the original one for dynamic injection
//      *
//      * @param graph      Original ObjectGraph
//      * @param extensions Potential ad-hoc extensions.
//      * @return The ObjectGraph
//      */
//     public ObjectGraph extend(ObjectGraph graph, Object[] extensions) {
//         return extensions.length == 0 ? graph : graph.plus(extensions);
//     }
// 
//     /**
//      * This allows the child Activities to configure their own extension modules to fit their needs
//      *
//      * @param originalGraph Original ObjectGraph, in case it requires some decision-making from higher-level compnents
//      * @param arguments     Configuration arguments of the Activity itself
//      * @return Array with extensions
//      */
//     protected abstract Object[] getExtensions(ObjectGraph originalGraph, Bundle arguments);
// }
// 
// Path: app/src/main/java/com/sefford/material/sample/common/ui/application/MaterialApplication.java
// public class MaterialApplication extends Application {
// 
// 
//     /**
//      * Object Injection Graph for development/production.
//      * <p/>
//      * We don't care this is static as the Application will live as long as the execution.
//      */
//     ObjectGraph objectGraph;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
// 
//         // Initialize Dagger's Dependency injection object Graph
//         objectGraph = initializeGraph();
//         objectGraph.inject(this);
//     }
// 
//     ObjectGraph initializeGraph() {
//         return ObjectGraph.create(new ApplicationModule(this),
//                 new DevelopmentLoggingModule());
//     }
// 
//     /**
//      * Injection facility for the elements.
//      *
//      * @param instance Instance of the object to inject dependencies
//      * @param <T>      Class that will be injected
//      */
//     public <T> void inject(T instance) {
//         objectGraph.inject(instance);
//     }
// 
//     /**
//      * Provider facility for the elements.
//      *
//      * @param type Type of the instance to get
//      * @param <T>  Class that will be injected
//      */
//     public <T> T get(Class<T> type) {
//         return objectGraph.get(type);
//     }
// 
//     public ObjectGraph getGraph() {
//         return objectGraph;
//     }
// }


import android.content.Context;
import com.sefford.material.sample.common.ui.activities.BaseActivity;
import com.sefford.material.sample.common.ui.application.MaterialApplication;
import dagger.Module;
import dagger.Provides;
import javax.inject.Named;
/*
 * Copyright (C) 2015 Saúl Díaz
 *
 * 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.sefford.material.sample.common.injection.modules;



/**
 * Application Module handles all the Application-related elements on the injection graph, in this case
 * the wide-app singleton Application context.
 * <p/>
 * We do not feat about leaking this context, as it is alive for as long as Android keeps the App in memory.
 */
@Module(
        includes = {
                CoreModule.class,
                DevelopmentLoggingModule.class,
        },
        injects = {
                // Application
// Path: app/src/main/java/com/sefford/material/sample/common/ui/activities/BaseActivity.java
// public abstract class BaseActivity extends Activity {
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         final ObjectGraph originalGraph = ((MaterialApplication) getApplication()).getGraph();
//         extend(originalGraph, getExtensions(originalGraph, getIntent().getExtras())).inject(this);
//     }
// 
//     /**
//      * Extends and returns the ObjectGraph with ad-hoc extensions or returns the original one for dynamic injection
//      *
//      * @param graph      Original ObjectGraph
//      * @param extensions Potential ad-hoc extensions.
//      * @return The ObjectGraph
//      */
//     public ObjectGraph extend(ObjectGraph graph, Object[] extensions) {
//         return extensions.length == 0 ? graph : graph.plus(extensions);
//     }
// 
//     /**
//      * This allows the child Activities to configure their own extension modules to fit their needs
//      *
//      * @param originalGraph Original ObjectGraph, in case it requires some decision-making from higher-level compnents
//      * @param arguments     Configuration arguments of the Activity itself
//      * @return Array with extensions
//      */
//     protected abstract Object[] getExtensions(ObjectGraph originalGraph, Bundle arguments);
// }
// 
// Path: app/src/main/java/com/sefford/material/sample/common/ui/application/MaterialApplication.java
// public class MaterialApplication extends Application {
// 
// 
//     /**
//      * Object Injection Graph for development/production.
//      * <p/>
//      * We don't care this is static as the Application will live as long as the execution.
//      */
//     ObjectGraph objectGraph;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
// 
//         // Initialize Dagger's Dependency injection object Graph
//         objectGraph = initializeGraph();
//         objectGraph.inject(this);
//     }
// 
//     ObjectGraph initializeGraph() {
//         return ObjectGraph.create(new ApplicationModule(this),
//                 new DevelopmentLoggingModule());
//     }
// 
//     /**
//      * Injection facility for the elements.
//      *
//      * @param instance Instance of the object to inject dependencies
//      * @param <T>      Class that will be injected
//      */
//     public <T> void inject(T instance) {
//         objectGraph.inject(instance);
//     }
// 
//     /**
//      * Provider facility for the elements.
//      *
//      * @param type Type of the instance to get
//      * @param <T>  Class that will be injected
//      */
//     public <T> T get(Class<T> type) {
//         return objectGraph.get(type);
//     }
// 
//     public ObjectGraph getGraph() {
//         return objectGraph;
//     }
// }


// Path: app/src/main/java/com/sefford/material/sample/common/injection/modules/ApplicationModule.java
import android.content.Context;
import com.sefford.material.sample.common.ui.activities.BaseActivity;
import com.sefford.material.sample.common.ui.application.MaterialApplication;
import dagger.Module;
import dagger.Provides;
import javax.inject.Named;

/*
 * Copyright (C) 2015 Saúl Díaz
 *
 * 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.sefford.material.sample.common.injection.modules;



/**
 * Application Module handles all the Application-related elements on the injection graph, in this case
 * the wide-app singleton Application context.
 * <p/>
 * We do not feat about leaking this context, as it is alive for as long as Android keeps the App in memory.
 */
@Module(
        includes = {
                CoreModule.class,
                DevelopmentLoggingModule.class,
        },
        injects = {
                // Application
                MaterialApplication.class,