优化
This commit is contained in:
@@ -976,6 +976,9 @@ class ReadBookActivity : BaseReadBookActivity(),
|
|||||||
if (menuLayoutIsVisible) {
|
if (menuLayoutIsVisible) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (binding.readView.run { isScroll && pageDelegate?.isRunning == true }) {
|
||||||
|
return
|
||||||
|
}
|
||||||
val readTime = ReadBookConfig.autoReadSpeed * 1000.0
|
val readTime = ReadBookConfig.autoReadSpeed * 1000.0
|
||||||
val height = binding.readView.height
|
val height = binding.readView.height
|
||||||
val scrollOffset = (height / readTime * frameTime).toInt().coerceAtLeast(1)
|
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()
|
val offset = (ChapterProvider.visibleHeight - textPage.height).toInt()
|
||||||
pageOffset = min(0, offset)
|
pageOffset = min(0, offset)
|
||||||
} else if (pageOffset > 0) {
|
} else if (pageOffset > 0) {
|
||||||
pageFactory.moveToPrev(false)
|
pageFactory.moveToPrev(true)
|
||||||
textPage = pageFactory.curPage
|
textPage = pageFactory.curPage
|
||||||
pageOffset -= textPage.height.toInt()
|
pageOffset -= textPage.height.toInt()
|
||||||
upView?.invoke(textPage)
|
upView?.invoke(textPage)
|
||||||
contentDescription = textPage.text
|
contentDescription = textPage.text
|
||||||
} else if (pageOffset < -textPage.height) {
|
} else if (pageOffset < -textPage.height) {
|
||||||
pageOffset += textPage.height.toInt()
|
pageOffset += textPage.height.toInt()
|
||||||
pageFactory.moveToNext(false)
|
pageFactory.moveToNext(true)
|
||||||
textPage = pageFactory.curPage
|
textPage = pageFactory.curPage
|
||||||
upView?.invoke(textPage)
|
upView?.invoke(textPage)
|
||||||
contentDescription = textPage.text
|
contentDescription = textPage.text
|
||||||
|
|||||||
@@ -526,12 +526,11 @@ class ReadView(context: Context, attrs: AttributeSet) :
|
|||||||
if (isScroll && !callBack.isAutoPage) {
|
if (isScroll && !callBack.isAutoPage) {
|
||||||
curPage.setContent(pageFactory.curPage, resetPageOffset)
|
curPage.setContent(pageFactory.curPage, resetPageOffset)
|
||||||
} else {
|
} else {
|
||||||
curPage.resetPageOffset()
|
|
||||||
when (relativePosition) {
|
when (relativePosition) {
|
||||||
-1 -> prevPage.setContent(pageFactory.prevPage)
|
-1 -> prevPage.setContent(pageFactory.prevPage)
|
||||||
1 -> nextPage.setContent(pageFactory.nextPage)
|
1 -> nextPage.setContent(pageFactory.nextPage)
|
||||||
else -> {
|
else -> {
|
||||||
curPage.setContent(pageFactory.curPage)
|
curPage.setContent(pageFactory.curPage, resetPageOffset)
|
||||||
nextPage.setContent(pageFactory.nextPage)
|
nextPage.setContent(pageFactory.nextPage)
|
||||||
prevPage.setContent(pageFactory.prevPage)
|
prevPage.setContent(pageFactory.prevPage)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user