Cleanup logic of onStripSplit in WebtoonPageHolder 2 (#7976)

This commit is contained in:
AntsyLich 2022-09-10 19:34:27 +06:00 committed by GitHub
parent 171d7f2b8c
commit 56826fb477
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -300,11 +300,12 @@ class WebtoonPageHolder(
// If we have reached this point [page] and its stream shouldn't be null // If we have reached this point [page] and its stream shouldn't be null
val page = page!! val page = page!!
val stream = page.stream!! val stream = page.stream!!
val splitData = ImageUtil.getSplitDataForStream(imageStream) val splitData = ImageUtil.getSplitDataForStream(imageStream).toMutableList()
val currentSplitData = splitData.removeFirst()
val newPages = splitData.map { val newPages = splitData.map {
StencilPage(page) { ImageUtil.splitStrip(it, stream) } StencilPage(page) { ImageUtil.splitStrip(it, stream) }
}.toMutableList() }
return newPages.removeFirst().stream!!() return ImageUtil.splitStrip(currentSplitData) { imageStream }
.also { .also {
// Running [onLongStripSplit] first results in issues with splitting // Running [onLongStripSplit] first results in issues with splitting
viewer.onLongStripSplit(page, newPages) viewer.onLongStripSplit(page, newPages)