This commit is contained in:
Horis
2025-04-24 12:31:47 +08:00
parent 645a0b274a
commit e0dd061cf1
2 changed files with 31 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ import android.os.Build
import android.text.Layout
import android.text.StaticLayout
import android.text.TextPaint
import androidx.core.os.postDelayed
import io.legado.app.constant.AppPattern
import io.legado.app.constant.EventBus
import io.legado.app.data.entities.Book
@@ -24,6 +25,7 @@ import io.legado.app.ui.book.read.page.entities.column.ImageColumn
import io.legado.app.ui.book.read.page.entities.column.ReviewColumn
import io.legado.app.ui.book.read.page.entities.column.TextColumn
import io.legado.app.utils.RealPathUtil
import io.legado.app.utils.buildMainHandler
import io.legado.app.utils.dpToPx
import io.legado.app.utils.fastSum
import io.legado.app.utils.isContentScheme
@@ -144,6 +146,12 @@ object ChapterProvider {
@JvmStatic
var visibleRect = RectF()
private val handler by lazy {
buildMainHandler()
}
private var upViewSizeRunnable: Runnable? = null
init {
upStyle()
}
@@ -946,12 +954,29 @@ object ChapterProvider {
* 更新View尺寸
*/
fun upViewSize(width: Int, height: Int) {
if (width > 0 && height > 0 && (width != viewWidth || height != viewHeight)) {
viewWidth = width
viewHeight = height
upLayout()
postEvent(EventBus.UP_CONFIG, arrayListOf(5))
if (width <= 0 || height <= 0) {
return
}
if (width != viewWidth || height != viewHeight) {
if (width == viewWidth) {
upViewSizeRunnable = handler.postDelayed(300) {
upViewSizeRunnable = null
notifyViewSizeChange(width, height)
}
} else {
notifyViewSizeChange(width, height)
}
} else if (upViewSizeRunnable != null) {
handler.removeCallbacks(upViewSizeRunnable!!)
upViewSizeRunnable = null
}
}
private fun notifyViewSizeChange(width: Int, height: Int) {
viewWidth = width
viewHeight = height
upLayout()
postEvent(EventBus.UP_CONFIG, arrayListOf(5))
}
/**

View File

@@ -76,6 +76,7 @@ object RhinoClassShutter : ClassShutter {
"android.app.ActivityThread",
"android.app.AppGlobals",
"android.os.Looper",
"android.os.Process",
"cn.hutool.core.lang.JarClassLoader",
"cn.hutool.core.lang.Singleton",