pull/2718/head
Horis 2 years ago
parent 3a7e6d3911
commit 68ff06c390
  1. 13
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/ScrollPageDelegate.kt
  2. 4
      app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt

@ -3,6 +3,7 @@ package io.legado.app.ui.book.read.page.delegate
import android.graphics.Canvas
import android.view.MotionEvent
import android.view.VelocityTracker
import io.legado.app.data.entities.Book
import io.legado.app.help.book.isImage
import io.legado.app.model.ReadBook
import io.legado.app.ui.book.read.page.ReadView
@ -132,11 +133,13 @@ class ScrollPageDelegate(readView: ReadView) : PageDelegate(readView) {
*/
private fun calcNextPageOffset(): Int {
val visibleHeight = ChapterProvider.visibleHeight
if (ReadBook.book?.isImage == true) {
val book = ReadBook.book!!
if (book.isImage) {
return -visibleHeight
}
val visiblePage = readView.getCurVisiblePage()
if (visiblePage.isImageOrEmpty()) {
val isTextStyle = book.getImageStyle().equals(Book.imgStyleText, true)
if (!isTextStyle && visiblePage.hasImageOrEmpty()) {
return -visibleHeight
}
val lastLineTop = visiblePage.lines.last().lineTop.toInt()
@ -146,11 +149,13 @@ class ScrollPageDelegate(readView: ReadView) : PageDelegate(readView) {
private fun calcPrevPageOffset(): Int {
val visibleHeight = ChapterProvider.visibleHeight
if (ReadBook.book?.isImage == true) {
val book = ReadBook.book!!
if (book.isImage) {
return visibleHeight
}
val visiblePage = readView.getCurVisiblePage()
if (visiblePage.isImageOrEmpty()) {
val isTextStyle = book.getImageStyle().equals(Book.imgStyleText, true)
if (!isTextStyle && visiblePage.hasImageOrEmpty()) {
return visibleHeight
}
val firstLineBottom = visiblePage.lines.first().lineBottom.toInt()

@ -233,7 +233,7 @@ data class TextPage(
return null
}
fun isImageOrEmpty(): Boolean {
return textLines.all { it.isTitle || it.isImage }
fun hasImageOrEmpty(): Boolean {
return textLines.any { it.isImage }
}
}

Loading…
Cancel
Save