Merge pull request #1479 from fansangg/fix/fade-page-anim
fix:翻页动画下页眉页脚信息闪烁的问题
This commit is contained in:
@@ -2,6 +2,8 @@ package io.legado.app.ui.book.read.page
|
|||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.graphics.Bitmap
|
||||||
|
import android.graphics.Canvas
|
||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
||||||
import android.graphics.drawable.LayerDrawable
|
import android.graphics.drawable.LayerDrawable
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
@@ -27,6 +29,7 @@ import io.legado.app.ui.widget.BatteryView
|
|||||||
import io.legado.app.utils.activity
|
import io.legado.app.utils.activity
|
||||||
import io.legado.app.utils.applyNavigationBarPadding
|
import io.legado.app.utils.applyNavigationBarPadding
|
||||||
import io.legado.app.utils.applyStatusBarPadding
|
import io.legado.app.utils.applyStatusBarPadding
|
||||||
|
import io.legado.app.utils.canvasrecorder.CanvasRecorder
|
||||||
import io.legado.app.utils.dpToPx
|
import io.legado.app.utils.dpToPx
|
||||||
import io.legado.app.utils.gone
|
import io.legado.app.utils.gone
|
||||||
import io.legado.app.utils.isContentScheme
|
import io.legado.app.utils.isContentScheme
|
||||||
@@ -35,6 +38,7 @@ import io.legado.app.utils.statusBarHeight
|
|||||||
import splitties.views.backgroundColor
|
import splitties.views.backgroundColor
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
import io.legado.app.utils.screenshot as viewScreenshot
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面视图
|
* 页面视图
|
||||||
@@ -468,6 +472,32 @@ class PageView(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun layoutSync() {
|
||||||
|
if (width <= 0 || height <= 0) return
|
||||||
|
if (!isLayoutRequested) return
|
||||||
|
measure(
|
||||||
|
MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
|
||||||
|
MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)
|
||||||
|
)
|
||||||
|
layout(left, top, right, bottom)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun screenshot(canvasRecorder: CanvasRecorder) {
|
||||||
|
if (!isMainView && !isScroll) {
|
||||||
|
setProgress(textPage)
|
||||||
|
layoutSync()
|
||||||
|
}
|
||||||
|
viewScreenshot(canvasRecorder)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun screenshot(bitmap: Bitmap? = null, canvas: Canvas? = null): Bitmap? {
|
||||||
|
if (!isMainView && !isScroll) {
|
||||||
|
setProgress(textPage)
|
||||||
|
layoutSync()
|
||||||
|
}
|
||||||
|
return viewScreenshot(bitmap, canvas)
|
||||||
|
}
|
||||||
|
|
||||||
fun setAutoPager(autoPager: AutoPager?) {
|
fun setAutoPager(autoPager: AutoPager?) {
|
||||||
binding.contentTextView.setAutoPager(autoPager)
|
binding.contentTextView.setAutoPager(autoPager)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user