@@ -591,7 +591,7 @@ public class EpubNavigatorFragment internal constructor(
591
591
}
592
592
593
593
@OptIn(DelicateReadiumApi ::class )
594
- override fun go (locator : Locator , animated : Boolean , completion : () -> Unit ): Boolean {
594
+ override fun go (locator : Locator , animated : Boolean ): Boolean {
595
595
@Suppress(" NAME_SHADOWING" )
596
596
val locator = publication.normalizeLocator(locator)
597
597
@@ -636,9 +636,9 @@ public class EpubNavigatorFragment internal constructor(
636
636
return true
637
637
}
638
638
639
- override fun go (link : Link , animated : Boolean , completion : () -> Unit ): Boolean {
639
+ override fun go (link : Link , animated : Boolean ): Boolean {
640
640
val locator = publication.locatorFromLink(link) ? : return false
641
- return go(locator, animated, completion )
641
+ return go(locator, animated)
642
642
}
643
643
644
644
private fun run (commands : List <RunScriptCommand >) {
@@ -846,9 +846,9 @@ public class EpubNavigatorFragment internal constructor(
846
846
?.let { publication.get(it) }
847
847
}
848
848
849
- override fun goForward (animated : Boolean , completion : () -> Unit ): Boolean {
849
+ override fun goForward (animated : Boolean ): Boolean {
850
850
if (publication.metadata.presentation.layout == EpubLayout .FIXED ) {
851
- return goToNextResource(jump = false , animated = animated, completion )
851
+ return goToNextResource(jump = false , animated = animated)
852
852
}
853
853
854
854
val webView = currentReflowablePageFragment?.webView ? : return false
@@ -860,13 +860,12 @@ public class EpubNavigatorFragment internal constructor(
860
860
ReadingProgression .RTL ->
861
861
webView.scrollLeft(animated)
862
862
}
863
- lifecycleScope.launch { completion() }
864
863
return true
865
864
}
866
865
867
- override fun goBackward (animated : Boolean , completion : () -> Unit ): Boolean {
866
+ override fun goBackward (animated : Boolean ): Boolean {
868
867
if (publication.metadata.presentation.layout == EpubLayout .FIXED ) {
869
- return goToPreviousResource(jump = false , animated = animated, completion )
868
+ return goToPreviousResource(jump = false , animated = animated)
870
869
}
871
870
872
871
val webView = currentReflowablePageFragment?.webView ? : return false
@@ -878,11 +877,10 @@ public class EpubNavigatorFragment internal constructor(
878
877
ReadingProgression .RTL ->
879
878
webView.scrollRight(animated)
880
879
}
881
- lifecycleScope.launch { completion() }
882
880
return true
883
881
}
884
882
885
- private fun goToNextResource (jump : Boolean , animated : Boolean , completion : () -> Unit = {} ): Boolean {
883
+ private fun goToNextResource (jump : Boolean , animated : Boolean ): Boolean {
886
884
val adapter = resourcePager.adapter ? : return false
887
885
if (resourcePager.currentItem >= adapter.count - 1 ) {
888
886
return false
@@ -902,11 +900,10 @@ public class EpubNavigatorFragment internal constructor(
902
900
}
903
901
}
904
902
905
- viewLifecycleOwner.lifecycleScope.launch { completion() }
906
903
return true
907
904
}
908
905
909
- private fun goToPreviousResource (jump : Boolean , animated : Boolean , completion : () -> Unit = {} ): Boolean {
906
+ private fun goToPreviousResource (jump : Boolean , animated : Boolean ): Boolean {
910
907
if (resourcePager.currentItem <= 0 ) {
911
908
return false
912
909
}
@@ -925,7 +922,6 @@ public class EpubNavigatorFragment internal constructor(
925
922
}
926
923
}
927
924
928
- viewLifecycleOwner.lifecycleScope.launch { completion() }
929
925
return true
930
926
}
931
927
0 commit comments