From 893415ff53fcffafca554af30f0522df92048b25 Mon Sep 17 00:00:00 2001 From: az4521 <18432684+az4521@users.noreply.github.com> Date: Sun, 31 Mar 2024 23:19:42 +0000 Subject: [PATCH] fix gif support --- .../ui/reader/viewer/pager/PagerPageHolder.kt | 13 ++++++------- .../ui/reader/viewer/webtoon/WebtoonPageHolder.kt | 14 ++++++-------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt index e1da1c6133a5..e068343b8a20 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt @@ -483,15 +483,16 @@ class PagerPageHolder( */ private fun ImageView.setImage(stream: InputStream) { GlideApp.with(this) + .asGif() .load(stream) .skipMemoryCache(true) .diskCacheStrategy(DiskCacheStrategy.NONE) .transition(DrawableTransitionOptions.with(NoTransition.getFactory())) - .listener(object : RequestListener { + .listener(object : RequestListener { override fun onLoadFailed( e: GlideException?, model: Any?, - target: Target, + target: Target, isFirstResource: Boolean ): Boolean { onImageDecodeError() @@ -499,15 +500,13 @@ class PagerPageHolder( } override fun onResourceReady( - resource: Drawable, + resource: GifDrawable, model: Any, - target: Target, + target: Target, dataSource: DataSource, isFirstResource: Boolean ): Boolean { - if (resource is GifDrawable) { - resource.setLoopCount(GifDrawable.LOOP_INTRINSIC) - } + resource.setLoopCount(GifDrawable.LOOP_INTRINSIC) onImageDecoded() return false } 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 3122bdf0689b..878ce005001e 100755 --- 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 @@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.ui.reader.viewer.webtoon import android.annotation.SuppressLint import android.content.res.Resources -import android.graphics.drawable.Drawable import android.view.Gravity import android.view.ViewGroup import android.view.ViewGroup.LayoutParams.MATCH_PARENT @@ -489,15 +488,16 @@ class WebtoonPageHolder( */ private fun ImageView.setImage(stream: InputStream) { GlideApp.with(this) + .asGif() .load(stream) .skipMemoryCache(true) .diskCacheStrategy(DiskCacheStrategy.NONE) .transition(DrawableTransitionOptions.with(NoTransition.getFactory())) - .listener(object : RequestListener { + .listener(object : RequestListener { override fun onLoadFailed( e: GlideException?, model: Any?, - target: Target, + target: Target, isFirstResource: Boolean ): Boolean { onImageDecodeError() @@ -505,15 +505,13 @@ class WebtoonPageHolder( } override fun onResourceReady( - resource: Drawable, + resource: GifDrawable, model: Any, - target: Target?, + target: Target?, dataSource: DataSource, isFirstResource: Boolean ): Boolean { - if (resource is GifDrawable) { - resource.setLoopCount(GifDrawable.LOOP_INTRINSIC) - } + resource.setLoopCount(GifDrawable.LOOP_INTRINSIC) onImageDecoded() return false }