Move dagger classes to injection directory

This commit is contained in:
inorichi 2015-10-21 21:04:10 +02:00
parent 57290a5395
commit 38c6fac385
7 changed files with 12 additions and 15 deletions

View file

@ -5,6 +5,10 @@ import android.content.Context;
import org.acra.annotation.ReportsCrashes;
import eu.kanade.mangafeed.injection.component.AppComponent;
import eu.kanade.mangafeed.injection.module.AppModule;
import eu.kanade.mangafeed.injection.ComponentReflectionInjector;
import eu.kanade.mangafeed.injection.component.DaggerAppComponent;
import timber.log.Timber;
@ReportsCrashes(
@ -46,14 +50,6 @@ public class App extends Application {
return mComponentInjector;
}
public static ComponentReflectionInjector<AppComponent> getComponentReflection(Context context) {
return get(context).getComponentReflection();
}
public static AppComponent getComponent(Context context) {
return get(context).getComponent();
}
// Needed to replace the component with a test specific one
public void setComponent(AppComponent applicationComponent) {
mApplicationComponent = applicationComponent;

View file

@ -1,4 +1,4 @@
package eu.kanade.mangafeed;
package eu.kanade.mangafeed.injection;
import java.lang.reflect.Method;
import java.util.HashMap;

View file

@ -1,11 +1,12 @@
package eu.kanade.mangafeed;
package eu.kanade.mangafeed.injection.component;
import android.app.Application;
import javax.inject.Singleton;
import dagger.Component;
import eu.kanade.mangafeed.data.DataModule;
import eu.kanade.mangafeed.injection.module.AppModule;
import eu.kanade.mangafeed.injection.module.DataModule;
import eu.kanade.mangafeed.presenter.CataloguePresenter;
import eu.kanade.mangafeed.presenter.LibraryPresenter;
import eu.kanade.mangafeed.presenter.MangaChaptersPresenter;

View file

@ -1,4 +1,4 @@
package eu.kanade.mangafeed;
package eu.kanade.mangafeed.injection.module;
import android.app.Application;

View file

@ -1,4 +1,4 @@
package eu.kanade.mangafeed.data;
package eu.kanade.mangafeed.injection.module;
import android.app.Application;

View file

@ -59,7 +59,7 @@ public abstract class BaseRxActivity<P extends Presenter> extends BaseActivity i
final PresenterFactory<P> superFactory = getPresenterFactory();
setPresenterFactory(() -> {
P presenter = superFactory.createPresenter();
App.getComponentReflection(getActivity()).inject(presenter);
((App)getApplication()).getComponentReflection().inject(presenter);
return presenter;
});

View file

@ -56,7 +56,7 @@ public abstract class BaseRxFragment<P extends Presenter> extends BaseFragment i
final PresenterFactory<P> superFactory = getPresenterFactory();
setPresenterFactory(() -> {
P presenter = superFactory.createPresenter();
App.getComponentReflection(getActivity()).inject(presenter);
((App)getActivity().getApplication()).getComponentReflection().inject(presenter);
return presenter;
});