mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-14 20:39:59 -05:00
parent
f508d10ad1
commit
06efc3b25c
4 changed files with 43 additions and 28 deletions
|
@ -17,6 +17,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fixed "currentTab was used multiple times"
|
- Fixed "currentTab was used multiple times"
|
||||||
- Fixed a rare crash when invoking "Mark previous as read" action
|
- Fixed a rare crash when invoking "Mark previous as read" action
|
||||||
|
- Fixed long strip images not loading in some old devices
|
||||||
|
|
||||||
### Improved
|
### Improved
|
||||||
- Bangumi search now shows the score and summary of a search result ([@MajorTanya](https://github.com/MajorTanya)) ([#1396](https://github.com/mihonapp/mihon/pull/1396))
|
- Bangumi search now shows the score and summary of a search result ([@MajorTanya](https://github.com/MajorTanya)) ([#1396](https://github.com/mihonapp/mihon/pull/1396))
|
||||||
|
|
|
@ -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.
|
||||||
|
@ -288,35 +289,42 @@ open class ReaderPageImageView @JvmOverloads constructor(
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
if (isWebtoon) {
|
when (data) {
|
||||||
val request = ImageRequest.Builder(context)
|
is BitmapDrawable -> {
|
||||||
.data(data)
|
setImage(ImageSource.bitmap(data.bitmap))
|
||||||
.memoryCachePolicy(CachePolicy.DISABLED)
|
isVisible = true
|
||||||
.diskCachePolicy(CachePolicy.DISABLED)
|
}
|
||||||
.target(
|
is BufferedSource -> {
|
||||||
onSuccess = { result ->
|
if (!isWebtoon || !ImageUtil.canUseCoilToDecode(data)) {
|
||||||
val image = result as BitmapImage
|
setImage(ImageSource.inputStream(data.inputStream()))
|
||||||
setImage(ImageSource.bitmap(image.bitmap))
|
isVisible = true
|
||||||
isVisible = true
|
} else {
|
||||||
},
|
val request = ImageRequest.Builder(context)
|
||||||
onError = {
|
.data(data)
|
||||||
this@ReaderPageImageView.onImageLoadError()
|
.memoryCachePolicy(CachePolicy.DISABLED)
|
||||||
},
|
.diskCachePolicy(CachePolicy.DISABLED)
|
||||||
)
|
.target(
|
||||||
.size(ViewSizeResolver(this@ReaderPageImageView))
|
onSuccess = { result ->
|
||||||
.precision(Precision.INEXACT)
|
val image = result as BitmapImage
|
||||||
.cropBorders(config.cropBorders)
|
setImage(ImageSource.bitmap(image.bitmap))
|
||||||
.customDecoder(true)
|
isVisible = true
|
||||||
.crossfade(false)
|
},
|
||||||
.build()
|
onError = {
|
||||||
context.imageLoader.enqueue(request)
|
this@ReaderPageImageView.onImageLoadError()
|
||||||
} else {
|
},
|
||||||
when (data) {
|
)
|
||||||
is BitmapDrawable -> setImage(ImageSource.bitmap(data.bitmap))
|
.size(ViewSizeResolver(this@ReaderPageImageView))
|
||||||
is BufferedSource -> setImage(ImageSource.inputStream(data.inputStream()))
|
.precision(Precision.INEXACT)
|
||||||
else -> throw IllegalArgumentException("Not implemented for class ${data::class.simpleName}")
|
.cropBorders(config.cropBorders)
|
||||||
|
.customDecoder(true)
|
||||||
|
.crossfade(false)
|
||||||
|
.build()
|
||||||
|
context.imageLoader.enqueue(request)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
throw IllegalArgumentException("Not implemented for class ${data::class.simpleName}")
|
||||||
}
|
}
|
||||||
isVisible = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ import androidx.core.graphics.get
|
||||||
import androidx.core.graphics.green
|
import androidx.core.graphics.green
|
||||||
import androidx.core.graphics.red
|
import androidx.core.graphics.red
|
||||||
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
|
||||||
|
@ -309,6 +310,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…
Reference in a new issue