diff --git a/app/build.gradle b/app/build.gradle index 86e839a..cbea937 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -55,13 +55,12 @@ android { dependencies { compile project(path: ':jsword-minimalbible', configuration: 'buildJSword') - // Not sure why, but using dagger 1.2.2 breaks esperandro's use of JavaWriter. - // TODO: Migrate to Dagger 1.2.2 - compile 'com.squareup.dagger:dagger:1.2.1' - provided 'com.squareup.dagger:dagger-compiler:1.2.1' + compile 'com.squareup.dagger:dagger:+' + provided 'com.squareup.dagger:dagger-compiler:+' - compile 'de.devland.esperandro:esperandro-api:+' - provided 'de.devland.esperandro:esperandro:+' + // TODO: Figure out why I need to force 2.1.0 and can't just use + + compile 'de.devland.esperandro:esperandro-api:2.1.0' + provided 'de.devland.esperandro:esperandro:2.1.0' compile 'com.jakewharton:butterknife:+' compile 'com.readystatesoftware.systembartint:systembartint:+' 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 02e6dd7..107c327 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 @@ -2,11 +2,13 @@ package org.bspeice.minimalbible.service.book; import android.support.v4.util.LruCache; +import org.bspeice.minimalbible.service.format.OsisToCanonicalTextSaxHandler; 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 org.xml.sax.SAXException; import rx.functions.Action1; import rx.schedulers.Schedulers; @@ -64,23 +66,24 @@ public class VerseLookupService implements Action1 { /** * Perform the ugly work of getting the actual data for a verse - * - * @param v - * @return + * TODO: Return a verse object, JS should be left to templating. + * @param v The verse to look up + * @return The string content of this verse */ public String doVerseLookup(Verse v) { BookData bookData = new BookData(book, v); try { SAXEventProvider provider = bookData.getSAXEventProvider(); -// provider.provideSAXEvents(new OsisParser()); - return provider.toString(); + OsisToCanonicalTextSaxHandler handler = new OsisToCanonicalTextSaxHandler(); + provider.provideSAXEvents(handler); + return handler.toString(); } catch (BookException e) { e.printStackTrace(); return "Unable to locate " + v.toString() + "!"; -// } catch (SAXException e) { -// e.printStackTrace(); + } catch (SAXException e) { + e.printStackTrace(); } -// return null; + return null; } /** @@ -114,11 +117,9 @@ public class VerseLookupService implements Action1 { * @return The name this verse should have in the cache */ private String getEntryName(Verse v) { - StringBuilder sb = new StringBuilder(); - sb.append(v.getBook().toString() + "_"); - sb.append(v.getChapter() + "_"); - sb.append(v.getVerse()); - return sb.toString(); + return v.getBook().toString() + "_" + + v.getChapter() + "_" + + v.getVerse(); } /*------------------------------------------------------------------------ diff --git a/app/src/main/java/org/bspeice/minimalbible/service/format/OsisToCanonicalTextSaxHandler.java b/app/src/main/java/org/bspeice/minimalbible/service/format/OsisToCanonicalTextSaxHandler.java index d72a82e..983f2c2 100644 --- a/app/src/main/java/org/bspeice/minimalbible/service/format/OsisToCanonicalTextSaxHandler.java +++ b/app/src/main/java/org/bspeice/minimalbible/service/format/OsisToCanonicalTextSaxHandler.java @@ -6,13 +6,12 @@ import org.crosswire.jsword.book.OSISUtil; import org.xml.sax.Attributes; import java.util.Stack; - /** * Convert OSIS input into Canonical text (used when creating search index) - * + * * @author Martin Denham [mjdenham at gmail dot com] * @see gnu.lgpl.License for license details.
- * The copyright to this program is held by it's author. + * The copyright to this program is held by it's author. */ public class OsisToCanonicalTextSaxHandler extends OsisSaxHandler { @@ -25,8 +24,6 @@ public class OsisToCanonicalTextSaxHandler extends OsisSaxHandler { super(); } - ; - @Override public void startDocument() { reset(); diff --git a/jsword-minimalbible b/jsword-minimalbible index 584c931..a7da87c 160000 --- a/jsword-minimalbible +++ b/jsword-minimalbible @@ -1 +1 @@ -Subproject commit 584c9314f768e9e09aa6d147287062e2c796263e +Subproject commit a7da87c2bc46959c7f9d1f245c7969367cc9c369