Android Open Source - YourConsole Daggered Application






From Project

Back to project page YourConsole.

License

The source code is released under:

MIT License

If you think the Android project YourConsole listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.akisute.yourconsole.app.dagger;
/*from  w w  w  . j a  v  a  2s.  co  m*/
import android.content.Context;

import java.util.Arrays;

import dagger.ObjectGraph;

public abstract class DaggeredApplication extends android.app.Application {

    private ObjectGraph mObjectGraph;
    private Context mInjectingContext;

    @Override
    public void onCreate() {
        super.onCreate();
        mObjectGraph = ObjectGraph.create(concatenate(new Object[]{new DaggeredApplicationModule(this)}, getModules()));
    }

    @Override
    public void onTerminate() {
        super.onTerminate();
        mObjectGraph = null;
    }

    public void inject(Object object) {
        mObjectGraph.inject(object);
    }

    public void inject(Context context) {
        mInjectingContext = context;
        mObjectGraph.inject(context);
        mInjectingContext = null;
    }

    public void inject(android.support.v4.app.Fragment fragment) {
        mInjectingContext = fragment.getActivity();
        mObjectGraph.inject(fragment);
        mInjectingContext = null;
    }

    public void inject(android.app.Fragment fragment) {
        mInjectingContext = fragment.getActivity();
        mObjectGraph.inject(fragment);
        mInjectingContext = null;
    }

    public Context getInjectingContext() {
        return mInjectingContext;
    }

    protected abstract Object[] getModules();

    private static <T> T[] concatenate(T[] first, T[] second) {
        T[] result = Arrays.copyOf(first, first.length + second.length);
        System.arraycopy(second, 0, result, first.length, second.length);
        return result;
    }
}




Java Source Code List

com.akisute.yourconsole.app.AppModule.java
com.akisute.yourconsole.app.Application.java
com.akisute.yourconsole.app.ConsoleViewerFragment.java
com.akisute.yourconsole.app.LogcatRecordingService.java
com.akisute.yourconsole.app.MainActivity.java
com.akisute.yourconsole.app.SaveIntentService.java
com.akisute.yourconsole.app.dagger.DaggeredActivity.java
com.akisute.yourconsole.app.dagger.DaggeredApplicationModule.java
com.akisute.yourconsole.app.dagger.DaggeredApplication.java
com.akisute.yourconsole.app.dagger.DaggeredFragment.java
com.akisute.yourconsole.app.dagger.DaggeredIntentService.java
com.akisute.yourconsole.app.dagger.DaggeredService.java
com.akisute.yourconsole.app.dagger.ForApplication.java
com.akisute.yourconsole.app.dagger.ForInjecting.java
com.akisute.yourconsole.app.helper.LogcatHelper.java
com.akisute.yourconsole.app.helper.RuntimeHelper.java
com.akisute.yourconsole.app.intent.Intents.java
com.akisute.yourconsole.app.model.ConsoleListAdapter.java
com.akisute.yourconsole.app.model.LogcatLine.java
com.akisute.yourconsole.app.model.LogcatRecordingManager.java
com.akisute.yourconsole.app.model.MText.java
com.akisute.yourconsole.app.reader.LogcatReader.java
com.akisute.yourconsole.app.reader.SingleLogcatReader.java
com.akisute.yourconsole.app.util.GlobalEventBus.java
com.akisute.yourconsole.app.util.GlobalPreference.java