UI/TTS improvements
This commit is contained in:
1 parent
0eba07b594
commit
ed66ea0d55
13 files changed
+250
-57
No files matched your search
@@ -574,12 +574,17 @@ private fun libraryLogFile(): File =
|
||||
File(System.getProperty("user.home"), ".toread/toread.log")
|
||||
|
||||
private fun ReadingPosition.toFormatHintsJson(): String =
|
||||
"""{"firstVisibleItemIndex":$itemIndex,"firstVisibleItemScrollOffset":$scrollOffset}"""
|
||||
buildString {
|
||||
append("""{"firstVisibleItemIndex":$itemIndex,"firstVisibleItemScrollOffset":$scrollOffset""")
|
||||
readAloudSentenceIndex?.let { append(""","readAloudSentenceIndex":$it""") }
|
||||
append("}")
|
||||
}
|
||||
|
||||
private fun String.toReadingPosition(): ReadingPosition? {
|
||||
val index = Regex(""""firstVisibleItemIndex"\s*:\s*(\d+)""").find(this)?.groupValues?.getOrNull(1)?.toIntOrNull()
|
||||
val offset = Regex(""""firstVisibleItemScrollOffset"\s*:\s*(\d+)""").find(this)?.groupValues?.getOrNull(1)?.toIntOrNull()
|
||||
return if (index != null && offset != null) ReadingPosition(index, offset) else null
|
||||
val sentenceIndex = Regex(""""readAloudSentenceIndex"\s*:\s*(\d+)""").find(this)?.groupValues?.getOrNull(1)?.toIntOrNull()
|
||||
return if (index != null && offset != null) ReadingPosition(index, offset, sentenceIndex) else null
|
||||
}
|
||||
|
||||
private fun String.toSearchPrefixes(): List<String> =
|
||||
|
||||
@@ -10,7 +10,7 @@ actual object ReadAloudPlatform {
|
||||
private val mutableSettingsState = MutableStateFlow(ReadAloudSettingsState())
|
||||
actual val settingsState: StateFlow<ReadAloudSettingsState> = mutableSettingsState
|
||||
|
||||
actual fun prepare(bookTitle: String, sentences: List<ReadAloudSentence>, startIndex: Int) = Unit
|
||||
actual fun prepare(fileId: String, bookTitle: String, sentences: List<ReadAloudSentence>, startIndex: Int) = Unit
|
||||
actual fun play() = Unit
|
||||
actual fun stop() = Unit
|
||||
actual fun skip(delta: Int) = Unit
|
||||
|
||||
Reference in new issue
Block a user