mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Move dagger classes to injection directory
This commit is contained in:
parent
57290a5395
commit
38c6fac385
7 changed files with 12 additions and 15 deletions
|
@ -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;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package eu.kanade.mangafeed;
|
||||
package eu.kanade.mangafeed.injection;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
|
@ -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;
|
|
@ -1,4 +1,4 @@
|
|||
package eu.kanade.mangafeed;
|
||||
package eu.kanade.mangafeed.injection.module;
|
||||
|
||||
import android.app.Application;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package eu.kanade.mangafeed.data;
|
||||
package eu.kanade.mangafeed.injection.module;
|
||||
|
||||
import android.app.Application;
|
||||
|
|
@ -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;
|
||||
});
|
||||
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue