diff --git a/app/src/main/java/org/bspeice/minimalbible/activity/downloader/DownloadActivityModules.java b/app/src/main/java/org/bspeice/minimalbible/activity/downloader/DownloadActivityModules.java index 7e93390..39335b2 100644 --- a/app/src/main/java/org/bspeice/minimalbible/activity/downloader/DownloadActivityModules.java +++ b/app/src/main/java/org/bspeice/minimalbible/activity/downloader/DownloadActivityModules.java @@ -8,8 +8,11 @@ import org.bspeice.minimalbible.activity.downloader.manager.RefreshManager; import org.crosswire.jsword.book.Book; import org.crosswire.jsword.book.BookCategory; import org.crosswire.jsword.book.Books; +import org.crosswire.jsword.book.install.InstallManager; +import org.crosswire.jsword.book.install.Installer; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import javax.inject.Named; @@ -82,4 +85,9 @@ public class DownloadActivityModules { List provideInstalledBooks(Books b) { return b.getBooks(); } + + @Provides @Singleton + Collection provideInstallers() { + return new InstallManager().getInstallers().values(); + } } diff --git a/app/src/main/java/org/bspeice/minimalbible/activity/downloader/manager/RefreshManager.java b/app/src/main/java/org/bspeice/minimalbible/activity/downloader/manager/RefreshManager.java index e0347df..3d47471 100644 --- a/app/src/main/java/org/bspeice/minimalbible/activity/downloader/manager/RefreshManager.java +++ b/app/src/main/java/org/bspeice/minimalbible/activity/downloader/manager/RefreshManager.java @@ -10,6 +10,7 @@ import org.crosswire.jsword.book.install.InstallManager; import org.crosswire.jsword.book.install.Installer; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -39,6 +40,9 @@ public class RefreshManager { private Observable>> availableModules; private final AtomicBoolean refreshComplete = new AtomicBoolean(); + @Inject + Collection installers; + @Inject public RefreshManager(Injector injector) { injector.inject(this); @@ -52,7 +56,7 @@ public class RefreshManager { */ private Observable>> refreshModules() { if (availableModules == null) { - availableModules = Observable.from(new InstallManager().getInstallers().values()) + availableModules = Observable.from(installers) .map(new Func1>>() { @Override public Map> call(Installer installer) {