parent
894f379cb3
commit
db902ad2f2
|
@ -5,7 +5,7 @@ ext {
|
|||
appName = 'Tachiyomi: MangaDex'
|
||||
pkgNameSuffix = 'all.mangadex'
|
||||
extClass = '.MangadexFactory'
|
||||
extVersionCode = 48
|
||||
extVersionCode = 49
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
|
|
|
@ -86,11 +86,16 @@ open class Mangadex(override val lang: String, private val internalLang: String,
|
|||
manga.setUrlWithoutDomain(url)
|
||||
manga.title = it.text().trim()
|
||||
}
|
||||
if (getShowThumbnail() == LOW_QUALITY) {
|
||||
manga.thumbnail_url = formThumbUrl(manga.url)
|
||||
}
|
||||
return manga
|
||||
}
|
||||
|
||||
private fun modifyMangaUrl(url: String): String = url.replace("/title/", "/manga/").substringBeforeLast("/") + "/"
|
||||
|
||||
private fun formThumbUrl(mangaUrl: String): String = cdnUrl + "/images/manga/" + getMangaId(mangaUrl) +".thumb.jpg"
|
||||
|
||||
override fun latestUpdatesFromElement(element: Element): SManga {
|
||||
val manga = SManga.create()
|
||||
element.let {
|
||||
|
@ -98,6 +103,10 @@ open class Mangadex(override val lang: String, private val internalLang: String,
|
|||
manga.title = it.text().trim()
|
||||
|
||||
}
|
||||
if (getShowThumbnail() == LOW_QUALITY) {
|
||||
manga.thumbnail_url = formThumbUrl(manga.url)
|
||||
}
|
||||
|
||||
return manga
|
||||
}
|
||||
|
||||
|
@ -251,6 +260,11 @@ open class Mangadex(override val lang: String, private val internalLang: String,
|
|||
manga.setUrlWithoutDomain(url)
|
||||
manga.title = it.text().trim()
|
||||
}
|
||||
|
||||
if (getShowThumbnail() == LOW_QUALITY) {
|
||||
manga.thumbnail_url = formThumbUrl(manga.url)
|
||||
}
|
||||
|
||||
return manga
|
||||
}
|
||||
|
||||
|
@ -462,10 +476,28 @@ open class Mangadex(override val lang: String, private val internalLang: String,
|
|||
preferences.edit().putInt(SHOW_R18_PREF, index).commit()
|
||||
}
|
||||
}
|
||||
val thumbsPref = ListPreference(screen.context).apply {
|
||||
key = SHOW_THUMBNAIL_PREF_Title
|
||||
title = SHOW_THUMBNAIL_PREF_Title
|
||||
|
||||
title = SHOW_THUMBNAIL_PREF_Title
|
||||
entries = arrayOf("Show high quality", "Show low quality")
|
||||
entryValues = arrayOf("0", "1")
|
||||
summary = "%s"
|
||||
|
||||
setOnPreferenceChangeListener { _, newValue ->
|
||||
val selected = newValue as String
|
||||
val index = this.findIndexOfValue(selected)
|
||||
preferences.edit().putInt(SHOW_THUMBNAIL_PREF, index).commit()
|
||||
}
|
||||
}
|
||||
|
||||
screen.addPreference(myPref)
|
||||
screen.addPreference(thumbsPref)
|
||||
}
|
||||
|
||||
private fun getShowR18(): Int = preferences.getInt(SHOW_R18_PREF, 0)
|
||||
private fun getShowThumbnail(): Int = preferences.getInt(SHOW_THUMBNAIL_PREF, 0)
|
||||
|
||||
|
||||
private class TextField(name: String, val key: String) : Filter.Text(name)
|
||||
|
@ -605,6 +637,12 @@ open class Mangadex(override val lang: String, private val internalLang: String,
|
|||
private const val SHOW_R18_PREF_Title = "Default R18 Setting"
|
||||
private const val SHOW_R18_PREF = "showR18Default"
|
||||
|
||||
private const val HIGH_QUALITY = 0
|
||||
private const val LOW_QUALITY = 1
|
||||
|
||||
private const val SHOW_THUMBNAIL_PREF_Title = "Default thumbnail quality"
|
||||
private const val SHOW_THUMBNAIL_PREF = "showThumbnailDefault"
|
||||
|
||||
private const val API_MANGA = "/api/manga/"
|
||||
private const val API_CHAPTER = "/api/chapter/"
|
||||
|
||||
|
@ -631,5 +669,4 @@ open class Mangadex(override val lang: String, private val internalLang: String,
|
|||
Pair("Thai", "32"),
|
||||
Pair("Filipino", "34"))
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue