mirror of
https://github.com/MinimalBible/MinimalBible
synced 2024-11-24 17:08:18 -05:00
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...
This commit is contained in:
parent
d6c5662fa5
commit
4e7393653b
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user