From cf266ce9fb02a1a66c6df70a2ac66af8b5681fa8 Mon Sep 17 00:00:00 2001 From: AwkwardPeak7 <48650614+AwkwardPeak7@users.noreply.github.com> Date: Tue, 19 Nov 2024 08:35:28 +0500 Subject: [PATCH] fix build --- .../tachiyomi/lib/zipinterceptor/ZipInterceptor.kt | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/zipinterceptor/src/main/java/eu/kanade/tachiyomi/lib/zipinterceptor/ZipInterceptor.kt b/lib/zipinterceptor/src/main/java/eu/kanade/tachiyomi/lib/zipinterceptor/ZipInterceptor.kt index 2c5f2facb..95e0c1831 100644 --- a/lib/zipinterceptor/src/main/java/eu/kanade/tachiyomi/lib/zipinterceptor/ZipInterceptor.kt +++ b/lib/zipinterceptor/src/main/java/eu/kanade/tachiyomi/lib/zipinterceptor/ZipInterceptor.kt @@ -21,13 +21,11 @@ import java.io.InputStream import java.lang.reflect.Method import java.util.zip.ZipInputStream -open class ZipInterceptor { +object ImageDecoderWrapper { private var decodeMethod: Method private var newInstanceMethod: Method private var classSignature = ClassSignature.Newest - private val dataUriRegex = Regex("""base64,([0-9a-zA-Z/+=\s]+)""") - private enum class ClassSignature { Old, New, Newest } @@ -40,7 +38,6 @@ open class ZipInterceptor { val inputStreamClass = InputStream::class.java try { - // Mihon Preview r6595+ classSignature = ClassSignature.Newest // decode(region, sampleSize) @@ -59,7 +56,6 @@ open class ZipInterceptor { ) } catch (_: NoSuchMethodException) { try { - // Mihon Stable & forks classSignature = ClassSignature.New // decode(region, rgb565, sampleSize, applyColorManagement, displayProfile) @@ -79,7 +75,6 @@ open class ZipInterceptor { booleanClass, ) } catch (_: NoSuchMethodException) { - // Tachiyomi J2k classSignature = ClassSignature.Old // decode(region, rgb565, sampleSize) @@ -126,7 +121,10 @@ open class ZipInterceptor { return bitmap } +} +open class ZipInterceptor { + private val dataUriRegex = Regex("""base64,([0-9a-zA-Z/+=\s]+)""") open fun zipGetByteStream(request: Request, response: Response): InputStream { return response.body.byteStream() @@ -165,7 +163,7 @@ open class ZipInterceptor { Base64.decode(b64, Base64.DEFAULT) } - entryIndex to decodeImage(imageData, isLowRamDevice, filename, entryName) + entryIndex to ImageDecoderWrapper.decodeImage(imageData, isLowRamDevice, filename, entryName) } .sortedBy { it.first } .toList()