mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
This commit is contained in:
@@ -193,6 +193,12 @@ object ReadBook : CoroutineScope by MainScope() {
|
||||
nextTextChapter = null
|
||||
}
|
||||
|
||||
fun clearSearchResult() {
|
||||
curTextChapter?.clearSearchResult()
|
||||
prevTextChapter?.clearSearchResult()
|
||||
nextTextChapter?.clearSearchResult()
|
||||
}
|
||||
|
||||
fun uploadProgress() {
|
||||
book?.let {
|
||||
launch(IO) {
|
||||
@@ -230,6 +236,7 @@ object ReadBook : CoroutineScope by MainScope() {
|
||||
hasNextPage = true
|
||||
it.getPage(durPageIndex)?.removePageAloudSpan()
|
||||
durChapterPos = nextPagePos
|
||||
callBack?.cancelSelect()
|
||||
callBack?.upContent()
|
||||
saveRead(true)
|
||||
}
|
||||
@@ -885,6 +892,8 @@ object ReadBook : CoroutineScope by MainScope() {
|
||||
fun upPageAnim(upRecorder: Boolean = false)
|
||||
|
||||
fun notifyBookChanged()
|
||||
|
||||
fun cancelSelect()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -852,8 +852,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
||||
*/
|
||||
override fun onMenuActionFinally() = binding.run {
|
||||
textActionMenu.dismiss()
|
||||
readView.curPage.cancelSelect()
|
||||
readView.isTextSelected = false
|
||||
readView.cancelSelect()
|
||||
}
|
||||
|
||||
private fun speak(text: String) {
|
||||
@@ -958,7 +957,6 @@ class ReadBookActivity : BaseReadBookActivity(),
|
||||
success: (() -> Unit)?
|
||||
) {
|
||||
lifecycleScope.launch {
|
||||
binding.readView.cancelSelect()
|
||||
binding.readView.upContent(relativePosition, resetPageOffset)
|
||||
if (relativePosition == 0) {
|
||||
upSeekBarProgress()
|
||||
@@ -973,7 +971,6 @@ class ReadBookActivity : BaseReadBookActivity(),
|
||||
resetPageOffset: Boolean,
|
||||
success: (() -> Unit)?
|
||||
) = withContext(Main.immediate) {
|
||||
binding.readView.cancelSelect()
|
||||
binding.readView.upContent(relativePosition, resetPageOffset)
|
||||
if (relativePosition == 0) {
|
||||
upSeekBarProgress()
|
||||
@@ -994,6 +991,12 @@ class ReadBookActivity : BaseReadBookActivity(),
|
||||
}
|
||||
}
|
||||
|
||||
override fun cancelSelect() {
|
||||
runOnUiThread {
|
||||
binding.readView.cancelSelect()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面改变
|
||||
*/
|
||||
@@ -1184,11 +1187,8 @@ class ReadBookActivity : BaseReadBookActivity(),
|
||||
isShowingSearchResult = false
|
||||
binding.searchMenu.invalidate()
|
||||
binding.searchMenu.invisible()
|
||||
binding.readView.isTextSelected = false
|
||||
ReadBook.curTextChapter?.clearSearchResult()
|
||||
ReadBook.prevTextChapter?.clearSearchResult()
|
||||
ReadBook.nextTextChapter?.clearSearchResult()
|
||||
binding.readView.curPage.cancelSelect(true)
|
||||
ReadBook.clearSearchResult()
|
||||
binding.readView.cancelSelect(true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -254,9 +254,9 @@ class ReadView(context: Context, attrs: AttributeSet) :
|
||||
return true
|
||||
}
|
||||
|
||||
fun cancelSelect() {
|
||||
fun cancelSelect(clearSearchResult: Boolean = false) {
|
||||
if (isTextSelected) {
|
||||
curPage.cancelSelect()
|
||||
curPage.cancelSelect(clearSearchResult)
|
||||
isTextSelected = false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user