RecyclerView now loads the text

It's actually surprisingly speedy, I'm impressed. This may just actually work, only thing left to do is implement the infinite scroll, and I'll have something worth testing...
So much easier than maintaining the JS build...
这个提交包含在:
Bradlee Speice
2014-11-25 22:49:30 -05:00
父节点 d6c5662fa5
当前提交 4e7393653b
共有 2 个文件被更改,包括 14 次插入3 次删除

查看文件

@ -8,6 +8,7 @@ import android.view.View
import android.view.LayoutInflater
import org.bspeice.minimalbible.R
import android.widget.TextView
import org.bspeice.minimalbible.service.format.osisparser.OsisParser
/**
* Adapter used for displaying a book
@ -25,7 +26,7 @@ class BookAdapter(val b: Book) : RecyclerView.Adapter<PassageView>() {
.inflate(R.layout.viewer_passage_view, parent, false)
val passage = PassageView(emptyView)
passage.v setText "1"
// passage.v setText o.getVerse(b, position).content
return passage
}
@ -33,7 +34,8 @@ class BookAdapter(val b: Book) : RecyclerView.Adapter<PassageView>() {
* Bind an existing view
*/
override fun onBindViewHolder(view: PassageView, position: Int) {
view.v setText "${Integer.parseInt(view.v.getText() as String) + 1}"
val o = OsisParser()
view.v setText o.getVerse(b, position).content
}
/**

查看文件

@ -8,6 +8,8 @@ import org.crosswire.jsword.book.OSISUtil
import org.bspeice.minimalbible.SafeValDelegate
import org.crosswire.jsword.book.BookData
import org.crosswire.jsword.book.Book
import org.crosswire.jsword.book.getVersification
import kotlin.properties.Delegates
/**
* Created by bspeice on 9/10/14.
@ -17,7 +19,7 @@ class OsisParser() : DefaultHandler() {
// Don't pass a verse as part of the constructor, but still guarantee
// that it will exist
var verseContent: VerseContent by SafeValDelegate()
var verseContent: VerseContent by Delegates.notNull()
// TODO: Implement a stack to keep min API 8
val doWrite = ArrayDeque<Boolean>()
@ -29,6 +31,13 @@ class OsisParser() : DefaultHandler() {
return verseContent.json
}
fun getVerse(b: Book, v: Int): VerseContent {
val verse = b.getVersification().decodeOrdinal(v)
verseContent = VerseContent(verse)
BookData(b, verse).getSAXEventProvider() provideSAXEvents this
return verseContent
}
override fun startElement(uri: String, localName: String,
qName: String, attributes: Attributes) {
when (localName) {