diff --git a/app/src/main/java/org/bspeice/minimalbible/activity/viewer/BookFragment.java b/app/src/main/java/org/bspeice/minimalbible/activity/viewer/BookFragment.java index 3de3071..8d92eed 100644 --- a/app/src/main/java/org/bspeice/minimalbible/activity/viewer/BookFragment.java +++ b/app/src/main/java/org/bspeice/minimalbible/activity/viewer/BookFragment.java @@ -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); diff --git a/app/src/main/java/org/bspeice/minimalbible/service/book/VerseLookupService.java b/app/src/main/java/org/bspeice/minimalbible/service/book/VerseLookupService.java index 3e03a29..ddfb5e1 100644 --- a/app/src/main/java/org/bspeice/minimalbible/service/book/VerseLookupService.java +++ b/app/src/main/java/org/bspeice/minimalbible/service/book/VerseLookupService.java @@ -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 { */ private PublishSubject 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 { * @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() + "!"; + } } /**