From 21f2947e60f038ee0a8b9715d4792d9932562f1f Mon Sep 17 00:00:00 2001 From: Tuomas Airaksinen Date: Fri, 11 Aug 2023 08:49:33 +0300 Subject: [PATCH] Fix offset in commentary speaking --- .../android/view/activity/page/BibleJavascriptInterface.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/net/bible/android/view/activity/page/BibleJavascriptInterface.kt b/app/src/main/java/net/bible/android/view/activity/page/BibleJavascriptInterface.kt index 23523a5ca8..251f227195 100644 --- a/app/src/main/java/net/bible/android/view/activity/page/BibleJavascriptInterface.kt +++ b/app/src/main/java/net/bible/android/view/activity/page/BibleJavascriptInterface.kt @@ -60,10 +60,12 @@ import net.bible.service.sword.mybible.myBibleIntToBibleBook import net.bible.service.sword.mysword.mySwordIntToBibleBook import org.crosswire.jsword.book.Books import org.crosswire.jsword.book.sword.SwordBook +import org.crosswire.jsword.passage.KeyUtil import org.crosswire.jsword.passage.Verse import org.crosswire.jsword.passage.VerseFactory import org.crosswire.jsword.versification.BookName import java.io.File +import java.lang.ClassCastException class BibleJavascriptInterface( @@ -393,8 +395,9 @@ class BibleJavascriptInterface( scope.launch(Dispatchers.Main) { val book = Books.installed().getBook(bookInitials) val key = book.getKey(osisRef) + val singleKey = try {KeyUtil.getVerse(key)} catch (e: ClassCastException) {key} val ordinalRange = OrdinalRange(ordinal, positiveOrNull(endOrdinal)?: ordinal) - val bookAndKey = BookAndKey(key, book, ordinalRange) + val bookAndKey = BookAndKey(singleKey, book, ordinalRange) mainBibleActivity.speakControl.speakGeneric(bookAndKey) } }