And I have working text.

This commit is contained in:
Bradlee Speice 2014-09-01 07:58:33 -04:00
parent c0c0643b84
commit c26beac6bb
4 changed files with 22 additions and 25 deletions

View File

@ -55,13 +55,12 @@ android {
dependencies { dependencies {
compile project(path: ':jsword-minimalbible', configuration: 'buildJSword') compile project(path: ':jsword-minimalbible', configuration: 'buildJSword')
// Not sure why, but using dagger 1.2.2 breaks esperandro's use of JavaWriter. compile 'com.squareup.dagger:dagger:+'
// TODO: Migrate to Dagger 1.2.2 provided 'com.squareup.dagger:dagger-compiler:+'
compile 'com.squareup.dagger:dagger:1.2.1'
provided 'com.squareup.dagger:dagger-compiler:1.2.1'
compile 'de.devland.esperandro:esperandro-api:+' // TODO: Figure out why I need to force 2.1.0 and can't just use +
provided 'de.devland.esperandro:esperandro:+' compile 'de.devland.esperandro:esperandro-api:2.1.0'
provided 'de.devland.esperandro:esperandro:2.1.0'
compile 'com.jakewharton:butterknife:+' compile 'com.jakewharton:butterknife:+'
compile 'com.readystatesoftware.systembartint:systembartint:+' compile 'com.readystatesoftware.systembartint:systembartint:+'

View File

@ -2,11 +2,13 @@ package org.bspeice.minimalbible.service.book;
import android.support.v4.util.LruCache; import android.support.v4.util.LruCache;
import org.bspeice.minimalbible.service.format.OsisToCanonicalTextSaxHandler;
import org.crosswire.common.xml.SAXEventProvider; import org.crosswire.common.xml.SAXEventProvider;
import org.crosswire.jsword.book.Book; import org.crosswire.jsword.book.Book;
import org.crosswire.jsword.book.BookData; import org.crosswire.jsword.book.BookData;
import org.crosswire.jsword.book.BookException; import org.crosswire.jsword.book.BookException;
import org.crosswire.jsword.passage.Verse; import org.crosswire.jsword.passage.Verse;
import org.xml.sax.SAXException;
import rx.functions.Action1; import rx.functions.Action1;
import rx.schedulers.Schedulers; import rx.schedulers.Schedulers;
@ -64,23 +66,24 @@ public class VerseLookupService implements Action1<Verse> {
/** /**
* Perform the ugly work of getting the actual data for a verse * Perform the ugly work of getting the actual data for a verse
* * TODO: Return a verse object, JS should be left to templating.
* @param v * @param v The verse to look up
* @return * @return The string content of this verse
*/ */
public String doVerseLookup(Verse v) { public String doVerseLookup(Verse v) {
BookData bookData = new BookData(book, v); BookData bookData = new BookData(book, v);
try { try {
SAXEventProvider provider = bookData.getSAXEventProvider(); SAXEventProvider provider = bookData.getSAXEventProvider();
// provider.provideSAXEvents(new OsisParser()); OsisToCanonicalTextSaxHandler handler = new OsisToCanonicalTextSaxHandler();
return provider.toString(); provider.provideSAXEvents(handler);
return handler.toString();
} catch (BookException e) { } catch (BookException e) {
e.printStackTrace(); e.printStackTrace();
return "Unable to locate " + v.toString() + "!"; return "Unable to locate " + v.toString() + "!";
// } catch (SAXException e) { } catch (SAXException e) {
// e.printStackTrace(); e.printStackTrace();
} }
// return null; return null;
} }
/** /**
@ -114,11 +117,9 @@ public class VerseLookupService implements Action1<Verse> {
* @return The name this verse should have in the cache * @return The name this verse should have in the cache
*/ */
private String getEntryName(Verse v) { private String getEntryName(Verse v) {
StringBuilder sb = new StringBuilder(); return v.getBook().toString() + "_" +
sb.append(v.getBook().toString() + "_"); v.getChapter() + "_" +
sb.append(v.getChapter() + "_"); v.getVerse();
sb.append(v.getVerse());
return sb.toString();
} }
/*------------------------------------------------------------------------ /*------------------------------------------------------------------------

View File

@ -6,7 +6,6 @@ import org.crosswire.jsword.book.OSISUtil;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import java.util.Stack; import java.util.Stack;
/** /**
* Convert OSIS input into Canonical text (used when creating search index) * Convert OSIS input into Canonical text (used when creating search index)
* *
@ -25,8 +24,6 @@ public class OsisToCanonicalTextSaxHandler extends OsisSaxHandler {
super(); super();
} }
;
@Override @Override
public void startDocument() { public void startDocument() {
reset(); reset();

@ -1 +1 @@
Subproject commit 584c9314f768e9e09aa6d147287062e2c796263e Subproject commit a7da87c2bc46959c7f9d1f245c7969367cc9c369