Figured out why I was getting some initial errors.

robolectric-error
Bradlee Speice 2014-08-09 20:52:02 -04:00
parent 1df6a13735
commit 6271cc9626
1 changed files with 16 additions and 0 deletions

View File

@ -3,12 +3,16 @@ package org.bspeice.minimalbible.activity.viewer;
import org.crosswire.jsword.book.Book;
import org.crosswire.jsword.book.Books;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
import rx.Observable;
import rx.functions.Action0;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.schedulers.Schedulers;
/**
@ -20,10 +24,22 @@ public class BookManager {
private Observable<Book> installedBooks;
private Boolean refreshComplete;
// Some of these books seem to think they're installed...
private List<String> excludeBooks = new ArrayList<String>() {{
add("ERen_no");
add("ot1nt2");
}};
@Inject
BookManager() {
// TODO: Any way this can be sped up goes straight to the initialization time.
installedBooks = Observable.from(Books.installed().getBooks())
.filter(new Func1<Book, Boolean>() {
@Override
public Boolean call(Book book) {
return !excludeBooks.contains(book.getInitials());
}
})
.cache();
installedBooks.subscribeOn(Schedulers.io())
.subscribe(new Action1<Book>() {