Fix long strip images not loading in some old devices
Fixes #1398 (cherry picked from commit 06efc3b25c5af51f42448af27a269ee459d9093d) # Conflicts: # CHANGELOG.md
This commit is contained in:
parent
226321f334
commit
e3dae57e0b
@ -40,6 +40,7 @@ import eu.kanade.tachiyomi.util.system.GLUtil
|
|||||||
import eu.kanade.tachiyomi.util.system.animatorDurationScale
|
import eu.kanade.tachiyomi.util.system.animatorDurationScale
|
||||||
import eu.kanade.tachiyomi.util.view.isVisibleOnScreen
|
import eu.kanade.tachiyomi.util.view.isVisibleOnScreen
|
||||||
import okio.BufferedSource
|
import okio.BufferedSource
|
||||||
|
import tachiyomi.core.common.util.system.ImageUtil
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A wrapper view for showing page image.
|
* A wrapper view for showing page image.
|
||||||
@ -287,7 +288,16 @@ open class ReaderPageImageView @JvmOverloads constructor(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
if (isWebtoon) {
|
when (data) {
|
||||||
|
is BitmapDrawable -> {
|
||||||
|
setImage(ImageSource.bitmap(data.bitmap))
|
||||||
|
isVisible = true
|
||||||
|
}
|
||||||
|
is BufferedSource -> {
|
||||||
|
if (!isWebtoon || !ImageUtil.canUseCoilToDecode(data)) {
|
||||||
|
setImage(ImageSource.inputStream(data.inputStream()))
|
||||||
|
isVisible = true
|
||||||
|
} else {
|
||||||
val request = ImageRequest.Builder(context)
|
val request = ImageRequest.Builder(context)
|
||||||
.data(data)
|
.data(data)
|
||||||
.memoryCachePolicy(CachePolicy.DISABLED)
|
.memoryCachePolicy(CachePolicy.DISABLED)
|
||||||
@ -309,13 +319,11 @@ open class ReaderPageImageView @JvmOverloads constructor(
|
|||||||
.crossfade(false)
|
.crossfade(false)
|
||||||
.build()
|
.build()
|
||||||
context.imageLoader.enqueue(request)
|
context.imageLoader.enqueue(request)
|
||||||
} else {
|
|
||||||
when (data) {
|
|
||||||
is BitmapDrawable -> setImage(ImageSource.bitmap(data.bitmap))
|
|
||||||
is BufferedSource -> setImage(ImageSource.inputStream(data.inputStream()))
|
|
||||||
else -> throw IllegalArgumentException("Not implemented for class ${data::class.simpleName}")
|
|
||||||
}
|
}
|
||||||
isVisible = true
|
}
|
||||||
|
else -> {
|
||||||
|
throw IllegalArgumentException("Not implemented for class ${data::class.simpleName}")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ import androidx.core.graphics.green
|
|||||||
import androidx.core.graphics.red
|
import androidx.core.graphics.red
|
||||||
import androidx.exifinterface.media.ExifInterface
|
import androidx.exifinterface.media.ExifInterface
|
||||||
import com.hippo.unifile.UniFile
|
import com.hippo.unifile.UniFile
|
||||||
|
import eu.kanade.tachiyomi.util.system.GLUtil
|
||||||
import logcat.LogPriority
|
import logcat.LogPriority
|
||||||
import okio.Buffer
|
import okio.Buffer
|
||||||
import okio.BufferedSource
|
import okio.BufferedSource
|
||||||
@ -359,6 +360,11 @@ object ImageUtil {
|
|||||||
val bottomOffset = topOffset + splitHeight
|
val bottomOffset = topOffset + splitHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun canUseCoilToDecode(imageSource: BufferedSource): Boolean {
|
||||||
|
val options = extractImageOptions(imageSource)
|
||||||
|
return maxOf(options.outWidth, options.outHeight) <= GLUtil.maxTextureSize
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Algorithm for determining what background to accompany a comic/manga page
|
* Algorithm for determining what background to accompany a comic/manga page
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user