mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
This commit is contained in:
@@ -976,6 +976,9 @@ class ReadBookActivity : BaseReadBookActivity(),
|
||||
if (menuLayoutIsVisible) {
|
||||
return
|
||||
}
|
||||
if (binding.readView.run { isScroll && pageDelegate?.isRunning == true }) {
|
||||
return
|
||||
}
|
||||
val readTime = ReadBookConfig.autoReadSpeed * 1000.0
|
||||
val height = binding.readView.height
|
||||
val scrollOffset = (height / readTime * frameTime).toInt().coerceAtLeast(1)
|
||||
|
||||
@@ -288,14 +288,14 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
|
||||
val offset = (ChapterProvider.visibleHeight - textPage.height).toInt()
|
||||
pageOffset = min(0, offset)
|
||||
} else if (pageOffset > 0) {
|
||||
pageFactory.moveToPrev(false)
|
||||
pageFactory.moveToPrev(true)
|
||||
textPage = pageFactory.curPage
|
||||
pageOffset -= textPage.height.toInt()
|
||||
upView?.invoke(textPage)
|
||||
contentDescription = textPage.text
|
||||
} else if (pageOffset < -textPage.height) {
|
||||
pageOffset += textPage.height.toInt()
|
||||
pageFactory.moveToNext(false)
|
||||
pageFactory.moveToNext(true)
|
||||
textPage = pageFactory.curPage
|
||||
upView?.invoke(textPage)
|
||||
contentDescription = textPage.text
|
||||
|
||||
@@ -526,12 +526,11 @@ class ReadView(context: Context, attrs: AttributeSet) :
|
||||
if (isScroll && !callBack.isAutoPage) {
|
||||
curPage.setContent(pageFactory.curPage, resetPageOffset)
|
||||
} else {
|
||||
curPage.resetPageOffset()
|
||||
when (relativePosition) {
|
||||
-1 -> prevPage.setContent(pageFactory.prevPage)
|
||||
1 -> nextPage.setContent(pageFactory.nextPage)
|
||||
else -> {
|
||||
curPage.setContent(pageFactory.curPage)
|
||||
curPage.setContent(pageFactory.curPage, resetPageOffset)
|
||||
nextPage.setContent(pageFactory.nextPage)
|
||||
prevPage.setContent(pageFactory.prevPage)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user