This commit is contained in:
Horis
2025-10-01 21:28:44 +08:00
parent 6aceec6a64
commit 4f09bbcf51
2 changed files with 21 additions and 6 deletions
@@ -1329,8 +1329,13 @@ class ReadBookActivity : BaseReadBookActivity(),
ReadAloud.upReadAloudClass()
val scrollPageAnim = ReadBook.pageAnim() == 3
if (scrollPageAnim) {
val startPos = binding.readView.getCurPagePosition()
ReadBook.readAloud(startPos = startPos)
val line = binding.readView.getCurVisibleFirstLine()
if (line != null) {
ReadBook.durChapterPos = line.chapterPosition
ReadBook.readAloud(startPos = line.pagePosition)
} else {
ReadBook.readAloud()
}
} else {
ReadBook.readAloud()
}
@@ -1340,8 +1345,13 @@ class ReadBookActivity : BaseReadBookActivity(),
val scrollPageAnim = ReadBook.pageAnim() == 3
if (scrollPageAnim && pageChanged) {
pageChanged = false
val startPos = binding.readView.getCurPagePosition()
ReadBook.readAloud(startPos = startPos)
val line = binding.readView.getCurVisibleFirstLine()
if (line != null) {
ReadBook.durChapterPos = line.chapterPosition
ReadBook.readAloud(startPos = line.pagePosition)
} else {
ReadBook.readAloud()
}
} else {
ReadAloud.resume(this)
}
@@ -1644,6 +1654,7 @@ class ReadBookActivity : BaseReadBookActivity(),
lifecycleScope.launch(IO) {
if (BaseReadAloudService.isPlay()) {
ReadBook.curTextChapter?.let { textChapter ->
ReadBook.durChapterPos = chapterStart
val pageIndex = ReadBook.durPageIndex
val aloudSpanStart = chapterStart - textChapter.getReadLength(pageIndex)
textChapter.getPage(pageIndex)
@@ -29,6 +29,7 @@ import io.legado.app.ui.book.read.page.delegate.SimulationPageDelegate
import io.legado.app.ui.book.read.page.delegate.SlidePageDelegate
import io.legado.app.ui.book.read.page.entities.PageDirection
import io.legado.app.ui.book.read.page.entities.TextChapter
import io.legado.app.ui.book.read.page.entities.TextLine
import io.legado.app.ui.book.read.page.entities.TextPage
import io.legado.app.ui.book.read.page.entities.TextPos
import io.legado.app.ui.book.read.page.entities.column.TextColumn
@@ -306,6 +307,8 @@ class ReadView(context: Context, attrs: AttributeSet) :
invalidate()
}
pageDelegate?.onScroll()
val offset = touchY - lastY
touchY -= offset - offset.toInt()
}
/**
@@ -451,6 +454,7 @@ class ReadView(context: Context, attrs: AttributeSet) :
{ progress -> callBack.sureNewProgress(progress) },
{ context.longToastOnUi(context.getString(R.string.upload_book_success)) },
{ context.longToastOnUi(context.getString(R.string.sync_book_progress_success)) })
13 -> {
if (BaseReadAloudService.isPlay()) {
ReadAloud.pause(context)
@@ -671,8 +675,8 @@ class ReadView(context: Context, attrs: AttributeSet) :
return curPage.getCurVisiblePage()
}
fun getCurPagePosition(): Int {
return curPage.getCurVisibleFirstLine()?.pagePosition ?: 0
fun getCurVisibleFirstLine(): TextLine? {
return curPage.getCurVisibleFirstLine()
}
fun invalidateTextPage() {