优化
This commit is contained in:
@@ -1329,8 +1329,13 @@ class ReadBookActivity : BaseReadBookActivity(),
|
|||||||
ReadAloud.upReadAloudClass()
|
ReadAloud.upReadAloudClass()
|
||||||
val scrollPageAnim = ReadBook.pageAnim() == 3
|
val scrollPageAnim = ReadBook.pageAnim() == 3
|
||||||
if (scrollPageAnim) {
|
if (scrollPageAnim) {
|
||||||
val startPos = binding.readView.getCurPagePosition()
|
val line = binding.readView.getCurVisibleFirstLine()
|
||||||
ReadBook.readAloud(startPos = startPos)
|
if (line != null) {
|
||||||
|
ReadBook.durChapterPos = line.chapterPosition
|
||||||
|
ReadBook.readAloud(startPos = line.pagePosition)
|
||||||
|
} else {
|
||||||
|
ReadBook.readAloud()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ReadBook.readAloud()
|
ReadBook.readAloud()
|
||||||
}
|
}
|
||||||
@@ -1340,8 +1345,13 @@ class ReadBookActivity : BaseReadBookActivity(),
|
|||||||
val scrollPageAnim = ReadBook.pageAnim() == 3
|
val scrollPageAnim = ReadBook.pageAnim() == 3
|
||||||
if (scrollPageAnim && pageChanged) {
|
if (scrollPageAnim && pageChanged) {
|
||||||
pageChanged = false
|
pageChanged = false
|
||||||
val startPos = binding.readView.getCurPagePosition()
|
val line = binding.readView.getCurVisibleFirstLine()
|
||||||
ReadBook.readAloud(startPos = startPos)
|
if (line != null) {
|
||||||
|
ReadBook.durChapterPos = line.chapterPosition
|
||||||
|
ReadBook.readAloud(startPos = line.pagePosition)
|
||||||
|
} else {
|
||||||
|
ReadBook.readAloud()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ReadAloud.resume(this)
|
ReadAloud.resume(this)
|
||||||
}
|
}
|
||||||
@@ -1644,6 +1654,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
|||||||
lifecycleScope.launch(IO) {
|
lifecycleScope.launch(IO) {
|
||||||
if (BaseReadAloudService.isPlay()) {
|
if (BaseReadAloudService.isPlay()) {
|
||||||
ReadBook.curTextChapter?.let { textChapter ->
|
ReadBook.curTextChapter?.let { textChapter ->
|
||||||
|
ReadBook.durChapterPos = chapterStart
|
||||||
val pageIndex = ReadBook.durPageIndex
|
val pageIndex = ReadBook.durPageIndex
|
||||||
val aloudSpanStart = chapterStart - textChapter.getReadLength(pageIndex)
|
val aloudSpanStart = chapterStart - textChapter.getReadLength(pageIndex)
|
||||||
textChapter.getPage(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.delegate.SlidePageDelegate
|
||||||
import io.legado.app.ui.book.read.page.entities.PageDirection
|
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.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.TextPage
|
||||||
import io.legado.app.ui.book.read.page.entities.TextPos
|
import io.legado.app.ui.book.read.page.entities.TextPos
|
||||||
import io.legado.app.ui.book.read.page.entities.column.TextColumn
|
import io.legado.app.ui.book.read.page.entities.column.TextColumn
|
||||||
@@ -306,6 +307,8 @@ class ReadView(context: Context, attrs: AttributeSet) :
|
|||||||
invalidate()
|
invalidate()
|
||||||
}
|
}
|
||||||
pageDelegate?.onScroll()
|
pageDelegate?.onScroll()
|
||||||
|
val offset = touchY - lastY
|
||||||
|
touchY -= offset - offset.toInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -451,6 +454,7 @@ class ReadView(context: Context, attrs: AttributeSet) :
|
|||||||
{ progress -> callBack.sureNewProgress(progress) },
|
{ progress -> callBack.sureNewProgress(progress) },
|
||||||
{ context.longToastOnUi(context.getString(R.string.upload_book_success)) },
|
{ context.longToastOnUi(context.getString(R.string.upload_book_success)) },
|
||||||
{ context.longToastOnUi(context.getString(R.string.sync_book_progress_success)) })
|
{ context.longToastOnUi(context.getString(R.string.sync_book_progress_success)) })
|
||||||
|
|
||||||
13 -> {
|
13 -> {
|
||||||
if (BaseReadAloudService.isPlay()) {
|
if (BaseReadAloudService.isPlay()) {
|
||||||
ReadAloud.pause(context)
|
ReadAloud.pause(context)
|
||||||
@@ -671,8 +675,8 @@ class ReadView(context: Context, attrs: AttributeSet) :
|
|||||||
return curPage.getCurVisiblePage()
|
return curPage.getCurVisiblePage()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCurPagePosition(): Int {
|
fun getCurVisibleFirstLine(): TextLine? {
|
||||||
return curPage.getCurVisibleFirstLine()?.pagePosition ?: 0
|
return curPage.getCurVisibleFirstLine()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun invalidateTextPage() {
|
fun invalidateTextPage() {
|
||||||
|
|||||||
Reference in New Issue
Block a user