Bible verse text goes through a multi-stage pipeline from binary storage to rendered SpannableStringBuilder displayed in a RecyclerView.
YES2 binary file
→ Yes2Reader.loadChapterText()
→ SingleChapterVerses (array of raw verse strings with formatting codes)
→ VersesDataModel (merges verses + pericope headers into display list)
→ VersesControllerImpl (RecyclerView adapter)
→ VerseRenderer.render() (applies formatting codes as spans)
→ VerseItem (custom RelativeLayout with background drawing)
Verse text uses inline formatting codes prefixed with @:
| Code | Meaning |
|---|---|
@@ |
Marks verse as having formatting (must be first) |
@0 |
Paragraph level 0 (no indent) |
@1–@4 |
Paragraph indent levels 1–4 |
@^ |
Continuation indent |
@6 |
Red letter start (Jesus' words) |
@5 |
Red letter end |
@9 |
Italic start |
@7 |
Italic end |
@8 |
Line break / blank line |
@<tag@> |
Start of special inline element (xref, footnote) |
@/ |
End of special inline element |
VerseRenderer.kt processes formatting codes and produces a SpannableStringBuilder:
- Detects
@@prefix to determine if verse has formatting - Iterates through characters, building spans for each formatting region
- Applies
ForegroundColorSpanfor red letters,StyleSpan(ITALIC)for italics - Handles indentation via
LeadingMarginSpan - Processes
@<tag@>blocks for cross-references and footnotes - Verse numbers are prepended as superscript spans
FormattedTextRenderer.kt is used for mock testing of the rendering pipeline. It simulates span application without Android framework dependencies.
FormattedVerseText.removeSpecialCodes() strips all @-codes to produce plain text for:
- Clipboard copy operations
- Search indexing
- Share text generation
This is important — search and copy must use the stripped text, not raw formatted text.
Pericopes (section headers like "The Sermon on the Mount") are rendered as distinct items in the RecyclerView, interleaved with verses. The VersesDataModel.itemPointer array maps display positions:
- Negative values → pericope index (bitwise NOT)
- Non-negative values → verse index (0-based)
VerseItem.kt is a custom RelativeLayout that handles:
- Checked/selected state visual feedback (colored background)
- "Attention" animation (pulse highlight when navigating to a verse)
- Drag-and-drop for progress mark pins
- Accessibility (TalkBack support with verse number and text)
- Highlight color painting on the background canvas
Font size is controlled by:
- Base
textSizepreference (user setting) - Per-version
textSizeMultmultiplier (fromPerVersionsettings) CalculatedDimensionsinS.applied()precomputes final sizes
Two-finger pinch gesture in IsiActivity adjusts the base text size in real time.