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 {
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:+'

View File

@ -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<Verse> {
/**
* 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<Verse> {
* @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();
}
/*------------------------------------------------------------------------

View File

@ -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.<br>
* 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();

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