瀏覽代碼

Fix wonky webtoon layout when image is loaded at the top of the screen (#5660)

Ivan Iskandar 3 年之前
父節點
當前提交
40aa3b7e18
共有 1 個文件被更改,包括 12 次插入1 次删除
  1. 12 1
      app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonPageHolder.kt

+ 12 - 1
app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonPageHolder.kt

@@ -266,7 +266,6 @@ class WebtoonPageHolder(
      */
     private fun setImage() {
         progressIndicator.setCompleteProgressAndHide()
-        progressContainer.isVisible = false
         retryContainer?.isVisible = false
         removeDecodeErrorLayout()
 
@@ -324,6 +323,13 @@ class WebtoonPageHolder(
         initRetryLayout().isVisible = true
     }
 
+    /**
+     * Called when the image is decoded and going to be displayed.
+     */
+    private fun onImageDecoded() {
+        progressContainer.isVisible = false
+    }
+
     /**
      * Called when the image fails to decode.
      */
@@ -374,6 +380,10 @@ class WebtoonPageHolder(
             setCropBorders(cropBorders)
             setOnImageEventListener(
                 object : SubsamplingScaleImageView.DefaultOnImageEventListener() {
+                    override fun onReady() {
+                        onImageDecoded()
+                    }
+
                     override fun onImageLoadError(e: Exception) {
                         onImageDecodeError()
                     }
@@ -505,6 +515,7 @@ class WebtoonPageHolder(
                         result.start()
                     }
                     setImageDrawable(result)
+                    onImageDecoded()
                 },
                 onError = {
                     onImageDecodeError()