Horis 2 lat temu
rodzic
commit
ccc5a16512

+ 2 - 1
app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt

@@ -96,7 +96,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
     override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
         super.onSizeChanged(w, h, oldw, oldh)
         if (!isMainView) return
-        ChapterProvider.upViewSize(w, h, oldw, oldh)
+        ChapterProvider.upViewSize(w, h)
         upVisibleRect()
         textPage.format()
     }
@@ -106,6 +106,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
         if (longScreenshot) {
             canvas.translate(0f, scrollY.toFloat())
         }
+        check(!visibleRect.isEmpty) { "visibleRect 为空" }
         canvas.clipRect(visibleRect)
         if (!callBack.isScroll && !isNoAnim) {
             pictureMirror.draw(canvas, width, height) {

+ 2 - 4
app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt

@@ -869,14 +869,12 @@ object ChapterProvider {
     /**
      * 更新View尺寸
      */
-    fun upViewSize(width: Int, height: Int, oldWidth: Int, oldHeight: Int) {
+    fun upViewSize(width: Int, height: Int) {
         if (width > 0 && height > 0 && (width != viewWidth || height != viewHeight)) {
             viewWidth = width
             viewHeight = height
             upLayout()
-            if (oldWidth > 0 && oldHeight > 0) {
-                postEvent(EventBus.UP_CONFIG, true)
-            }
+            postEvent(EventBus.UP_CONFIG, true)
         }
     }