mihon/app/src/main/java/eu/kanade/mangafeed/App.java

39 lines
982 B
Java
Raw Normal View History

2015-09-24 17:27:43 +02:00
package eu.kanade.mangafeed;
import android.app.Application;
import android.content.Context;
import timber.log.Timber;
public class App extends Application {
AppComponent mApplicationComponent;
@Override
public void onCreate() {
super.onCreate();
if (BuildConfig.DEBUG) Timber.plant(new Timber.DebugTree());
mApplicationComponent = DaggerAppComponent.builder()
.appModule(new AppModule(this))
.build();
}
public static App get(Context context) {
return (App) context.getApplicationContext();
}
public AppComponent getComponent() {
return mApplicationComponent;
}
2015-09-26 14:25:18 +02:00
public static AppComponent getComponent(Context context) {
return get(context).getComponent();
}
2015-09-24 17:27:43 +02:00
// Needed to replace the component with a test specific one
public void setComponent(AppComponent applicationComponent) {
mApplicationComponent = applicationComponent;
}
}