mirror of
https://github.com/MinimalBible/MinimalBible
synced 2024-12-22 14:48:23 -05:00
One more static reference refactoring
This commit is contained in:
parent
80e38dacb4
commit
a9b06a7fde
@ -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<Book> provideInstalledBooks(Books b) {
|
||||
return b.getBooks();
|
||||
}
|
||||
|
||||
@Provides @Singleton
|
||||
Collection<Installer> provideInstallers() {
|
||||
return new InstallManager().getInstallers().values();
|
||||
}
|
||||
}
|
||||
|
@ -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<Map<Installer, List<Book>>> availableModules;
|
||||
private final AtomicBoolean refreshComplete = new AtomicBoolean();
|
||||
|
||||
@Inject
|
||||
Collection<Installer> installers;
|
||||
|
||||
@Inject
|
||||
public RefreshManager(Injector injector) {
|
||||
injector.inject(this);
|
||||
@ -52,7 +56,7 @@ public class RefreshManager {
|
||||
*/
|
||||
private Observable<Map<Installer, List<Book>>> refreshModules() {
|
||||
if (availableModules == null) {
|
||||
availableModules = Observable.from(new InstallManager().getInstallers().values())
|
||||
availableModules = Observable.from(installers)
|
||||
.map(new Func1<Installer, Map<Installer, List<Book>>>() {
|
||||
@Override
|
||||
public Map<Installer, List<Book>> call(Installer installer) {
|
||||
|
Loading…
Reference in New Issue
Block a user