From 484cfdd39f432d5cdbbc666c15adc99dd2ea6410 Mon Sep 17 00:00:00 2001
From: Pavka
Date: Mon, 16 Nov 2020 15:42:04 +0300
Subject: [PATCH] [Ru] Remanga. Fix default popular sorting. Fix encoding pages
to png (#4883)
* [Ru] Remanga. Fix default popular sorting. Fix encoding pages to png
* Fix black parts of images
Co-authored-by: pavkazzz
---
src/ru/remanga/build.gradle | 2 +-
.../kanade/tachiyomi/extension/ru/remanga/Remanga.kt | 10 +++++++---
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/ru/remanga/build.gradle b/src/ru/remanga/build.gradle
index 693027ed0..f19e4eac1 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 = 8
+ extVersionCode = 9
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 a660ba17e..f418e32e3 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
@@ -116,7 +116,7 @@ class Remanga : ConfigurableSource, HttpSource() {
return user.content.access_token
}
- override fun popularMangaRequest(page: Int) = GET("$baseUrl/api/search/catalog/?ordering=rating&count=$count&page=$page", headers)
+ override fun popularMangaRequest(page: Int) = GET("$baseUrl/api/search/catalog/?ordering=-rating&count=$count&page=$page", headers)
override fun popularMangaParse(response: Response): MangasPage = searchMangaParse(response)
@@ -159,7 +159,7 @@ class Remanga : ConfigurableSource, HttpSource() {
(if (filters.isEmpty()) getFilterList() else filters).forEach { filter ->
when (filter) {
is OrderBy -> {
- val ord = arrayOf("id", "chapter_date", "rating", "votes", "views", "ount_chapters", "random")[filter.state!!.index]
+ val ord = arrayOf("id", "chapter_date", "rating", "votes", "views", "count_chapters", "random")[filter.state!!.index]
url.addQueryParameter("ordering", if (filter.state!!.ascending) "$ord" else "-$ord")
}
is CategoryList -> filter.state.forEach { category ->
@@ -341,14 +341,18 @@ class Remanga : ConfigurableSource, HttpSource() {
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.PNG, 100, output)
+ cs.compress(Bitmap.CompressFormat.JPEG, 100, output)
return Base64.encodeToString(output.toByteArray(), Base64.DEFAULT)
}