From 40aa3b7e1811799aa377314589ea3ae0a5d19b55 Mon Sep 17 00:00:00 2001 From: Ivan Iskandar <12537387+ivaniskandar@users.noreply.github.com> Date: Fri, 6 Aug 2021 04:51:03 +0700 Subject: [PATCH] Fix wonky webtoon layout when image is loaded at the top of the screen (#5660) --- .../ui/reader/viewer/webtoon/WebtoonPageHolder.kt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonPageHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonPageHolder.kt index 29f6aa1469..2fd37402f7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonPageHolder.kt +++ b/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()