diff --git a/src/ru/remanga/build.gradle b/src/ru/remanga/build.gradle index a6ca0975a..3e39768a3 100644 --- a/src/ru/remanga/build.gradle +++ b/src/ru/remanga/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'Remanga' pkgNameSuffix = 'ru.remanga' extClass = '.Remanga' - extVersionCode = 17 + extVersionCode = 18 libVersion = '1.2' } diff --git a/src/ru/remanga/src/eu/kanade/tachiyomi/extension/ru/remanga/Remanga.kt b/src/ru/remanga/src/eu/kanade/tachiyomi/extension/ru/remanga/Remanga.kt index 19a92f5ad..3e8babcfa 100644 --- a/src/ru/remanga/src/eu/kanade/tachiyomi/extension/ru/remanga/Remanga.kt +++ b/src/ru/remanga/src/eu/kanade/tachiyomi/extension/ru/remanga/Remanga.kt @@ -14,14 +14,10 @@ import android.annotation.SuppressLint import android.annotation.TargetApi import android.app.Application import android.content.SharedPreferences -import android.graphics.Bitmap -import android.graphics.BitmapFactory -import android.graphics.Canvas import android.os.Build import android.support.v7.preference.EditTextPreference import android.support.v7.preference.PreferenceScreen import android.text.InputType -import android.util.Base64 import android.widget.Toast import com.github.salomonbrys.kotson.fromJson import com.google.gson.Gson @@ -53,7 +49,6 @@ import org.jsoup.Jsoup import rx.Observable import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import java.io.ByteArrayOutputStream import java.text.SimpleDateFormat import java.util.Date import java.util.Locale @@ -329,44 +324,22 @@ class Remanga : ConfigurableSource, HttpSource() { } } catch (e: JsonSyntaxException) { val page = gson.fromJson>(body) - page.content.pages.mapIndexed { i, element -> - Page(i, element.joinToString { it.link }) + val result = mutableListOf() + page.content.pages.forEach { + it.forEach { + result.add(Page(result.size, "", it.link)) + } } + return result } } - override fun fetchImageUrl(page: Page): Observable { - val urls = page.url.split(", ") - val res = this.combineImage(urls) - return Observable.just("https://127.0.0.1/?imagebase64,$res") - } + override fun fetchImageUrl(page: Page): Observable = Observable.just(page.imageUrl!!) override fun imageUrlRequest(page: Page): Request = throw NotImplementedError("Unused") override fun imageUrlParse(response: Response): String = throw NotImplementedError("Unused") - private fun combineImage(pages: List): String { - val refererHeaders = headersBuilder().build() - val s = client.newCall(GET(pages[0], refererHeaders)).execute().body()!!.bytes() - val b = BitmapFactory.decodeByteArray(s, 0, s.size) - - val cs = Bitmap.createBitmap(b.width, b.height * pages.size, Bitmap.Config.ARGB_8888) - val comboImage = Canvas(cs) - var totalHeight = b.height - comboImage.drawBitmap(b, 0f, 0f, null) - for (i in 1 until pages.size) { - val bytes = client.newCall(GET(pages[i], refererHeaders)).execute().body()!!.bytes() - val bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.size) - comboImage.drawBitmap(bitmap, 0f, (b.height * i).toFloat(), null) - totalHeight += bitmap.getHeight() - } - cs.reconfigure(cs.getWidth(), totalHeight, cs.getConfig()) - - val output = ByteArrayOutputStream() - cs.compress(Bitmap.CompressFormat.JPEG, 100, output) - return Base64.encodeToString(output.toByteArray(), Base64.DEFAULT) - } - override fun imageRequest(page: Page): Request { val refererHeaders = headersBuilder().build() return GET(page.imageUrl!!, refererHeaders)