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,17 +210,12 @@ 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)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Logger.e(e)
|
||||
setError()
|
||||
return
|
||||
}
|
||||
withUIContext {
|
||||
frame.setImage(
|
||||
source,
|
||||
|
@ -234,6 +229,12 @@ class WebtoonPageHolder(
|
|||
),
|
||||
)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Logger.e(e)
|
||||
withUIContext {
|
||||
setError()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun process(imageSource: BufferedSource): BufferedSource {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue