@dr33m/react-native-readium 5.0.0-rc.21 → 5.0.0-rc.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -274,26 +274,30 @@ abstract class BaseReaderFragment : Fragment() {
|
|
|
274
274
|
fun ttsSkipPrevious() { ttsManager?.skipPrevious() }
|
|
275
275
|
|
|
276
276
|
private fun applyTTSDecoration(locator: Locator) {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
//
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
277
|
+
if (!isNavigatorReady) return
|
|
278
|
+
val decorableNavigator = navigator as? DecorableNavigator ?: return
|
|
279
|
+
// Call applyDecorations directly — it is a regular (non-suspend) function in
|
|
280
|
+
// Readium 3.x. The test app (VisualReaderFragment) does the same: no launch {},
|
|
281
|
+
// no channel routing. Wrapping in viewScope.launch defers the call to the next
|
|
282
|
+
// dispatch cycle and was preventing the highlight from ever appearing.
|
|
283
|
+
decorableNavigator.applyDecorations(
|
|
284
|
+
listOf(
|
|
285
|
+
Decoration(
|
|
286
|
+
id = "tts",
|
|
287
|
+
locator = locator,
|
|
288
|
+
style = Decoration.Style.Highlight(
|
|
289
|
+
tint = android.graphics.Color.argb(89, 0xF2, 0xCA, 0x50) // #f2ca50 @ 35%
|
|
289
290
|
)
|
|
290
291
|
)
|
|
291
|
-
)
|
|
292
|
+
),
|
|
293
|
+
"tts"
|
|
292
294
|
)
|
|
293
295
|
}
|
|
294
296
|
|
|
295
297
|
private fun clearTTSDecoration() {
|
|
296
|
-
|
|
298
|
+
if (!isNavigatorReady) return
|
|
299
|
+
val decorableNavigator = navigator as? DecorableNavigator ?: return
|
|
300
|
+
decorableNavigator.applyDecorations(emptyList(), "tts")
|
|
297
301
|
}
|
|
298
302
|
|
|
299
303
|
override fun onDestroyView() {
|