mirror of
https://github.com/MinimalBible/MinimalBible
synced 2025-06-30 21:36:10 -04:00
Better quote handling, parsing state refactor
Should be easier to test in the future Still needs some work on spacing
This commit is contained in:
@ -3,7 +3,6 @@ package org.bspeice.minimalbible.activity.viewer
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.widget.TextView
|
||||
import com.orhanobut.logger.Logger
|
||||
import org.bspeice.minimalbible.service.format.osisparser.OsisParser
|
||||
import org.crosswire.jsword.book.Book
|
||||
import org.crosswire.jsword.book.getVersification
|
||||
@ -11,18 +10,18 @@ import org.crosswire.jsword.book.getVersification
|
||||
class PassageView(val v: TextView, val b: Book)
|
||||
: RecyclerView.ViewHolder(v) {
|
||||
|
||||
val parser = OsisParser()
|
||||
|
||||
fun buildOrdinal(verse: Int, info: BookAdapter.ChapterInfo) =
|
||||
b.getVersification().decodeOrdinal(verse + info.vOffset)
|
||||
|
||||
fun getAllVerses(verses: Progression<Int>, info: BookAdapter.ChapterInfo): SpannableStringBuilder {
|
||||
val builder = SpannableStringBuilder()
|
||||
val parser = OsisParser()
|
||||
verses.forEach { parser.appendVerse(b, buildOrdinal(it, info), builder) }
|
||||
return builder
|
||||
}
|
||||
|
||||
fun bind(info: BookAdapter.ChapterInfo) {
|
||||
Logger.d("PassageView", "Binding chapter ${info.chapter}")
|
||||
v setText getAllVerses(info.vStart..info.vEnd, info)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user