mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
refactor(WebtoonPageHolder): Move stuff around
This commit is contained in:
parent
9d16172095
commit
75d73cf604
1 changed files with 18 additions and 17 deletions
|
@ -210,29 +210,30 @@ class WebtoonPageHolder(
|
|||
|
||||
val streamFn = page?.stream ?: return
|
||||
|
||||
val (source, isAnimated) = try {
|
||||
withIOContext {
|
||||
try {
|
||||
val (source, isAnimated) = withIOContext {
|
||||
val source = streamFn().use { process(Buffer().readFrom(it)) }
|
||||
val isAnimated = ImageUtil.isAnimatedAndSupported(source)
|
||||
Pair(source, isAnimated)
|
||||
}
|
||||
withUIContext {
|
||||
frame.setImage(
|
||||
source,
|
||||
isAnimated,
|
||||
ReaderPageImageView.Config(
|
||||
zoomDuration = viewer.config.doubleTapAnimDuration,
|
||||
minimumScaleType = SubsamplingScaleImageView.SCALE_TYPE_FIT_WIDTH,
|
||||
cropBorders = viewer.config.run {
|
||||
if (viewer.hasMargins) { verticalCropBorders } else { webtoonCropBorders }
|
||||
},
|
||||
),
|
||||
)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Logger.e(e)
|
||||
setError()
|
||||
return
|
||||
}
|
||||
withUIContext {
|
||||
frame.setImage(
|
||||
source,
|
||||
isAnimated,
|
||||
ReaderPageImageView.Config(
|
||||
zoomDuration = viewer.config.doubleTapAnimDuration,
|
||||
minimumScaleType = SubsamplingScaleImageView.SCALE_TYPE_FIT_WIDTH,
|
||||
cropBorders = viewer.config.run {
|
||||
if (viewer.hasMargins) { verticalCropBorders } else { webtoonCropBorders }
|
||||
},
|
||||
),
|
||||
)
|
||||
withUIContext {
|
||||
setError()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue