More skeleton updates to make things look nice

This commit is contained in:
Bradlee Speice 2014-08-09 20:45:35 -04:00
parent 302ae9d6f4
commit 1df6a13735
2 changed files with 13 additions and 6 deletions

View File

@ -72,7 +72,7 @@ public class BookFragment extends BaseFragment {
false);
((Injector)getActivity()).inject(this);
// TODO: Defer lookup until after webview created? When exactly is WebView created?
this.lookupService = new VerseLookupService(mBook.get(), this.getActivity());
this.lookupService = new VerseLookupService(mBook.get());
ButterKnife.inject(this, rootView);
mainContent.getSettings().setJavaScriptEnabled(true);

View File

@ -1,9 +1,11 @@
package org.bspeice.minimalbible.service.book;
import android.content.Context;
import android.support.v4.util.LruCache;
import org.crosswire.common.xml.SAXEventProvider;
import org.crosswire.jsword.book.Book;
import org.crosswire.jsword.book.BookData;
import org.crosswire.jsword.book.BookException;
import org.crosswire.jsword.passage.Verse;
import rx.functions.Action1;
@ -33,7 +35,7 @@ public class VerseLookupService implements Action1<Verse> {
*/
private PublishSubject<Verse> listener = PublishSubject.create();
public VerseLookupService(Book b, Context ctx) {
public VerseLookupService(Book b) {
listener.subscribeOn(Schedulers.io())
.subscribe(this);
this.book = b;
@ -66,9 +68,14 @@ public class VerseLookupService implements Action1<Verse> {
* @return
*/
public String doVerseLookup(Verse v) {
//BookData bookData = new BookData(book, v);
return "Not yet implemented!";
BookData bookData = new BookData(book, v);
try {
SAXEventProvider provider = bookData.getSAXEventProvider();
return provider.toString();
} catch (BookException e) {
e.printStackTrace();
return "Unable to locate " + v.toString() + "!";
}
}
/**