Figured out why I was getting some initial errors.

This commit is contained in:
Bradlee Speice 2014-08-09 20:52:02 -04:00
parent 1df6a13735
commit 6271cc9626

View File

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