mirror of
https://github.com/keiyoushi/extensions-source.git
synced 2024-11-25 03:33:24 +01:00
MANGA Plus: Add preference to remove the chapter number from the name and add the site name as scanlator (#4965)
* asasdsa * more * this is useless
This commit is contained in:
parent
ca54fbeb02
commit
8ddac0df2b
@ -17,6 +17,8 @@ schedule_monthly=Monthly
|
||||
schedule_other=Other
|
||||
schedule_trimonthly=Trimonthly
|
||||
schedule_weekly=Weekly
|
||||
subtitle_only=Show subtitle only
|
||||
subtitle_only_summary=Removes the redundant chapter number from the chapter name.
|
||||
serialization=Serialization: %s
|
||||
split_double_pages=Split double pages
|
||||
split_double_pages_summary=Only a few titles supports disabling this setting.
|
||||
|
@ -1,7 +1,7 @@
|
||||
ext {
|
||||
extName = 'MANGA Plus by SHUEISHA'
|
||||
extClass = '.MangaPlusFactory'
|
||||
extVersionCode = 51
|
||||
extVersionCode = 52
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
@ -284,10 +284,11 @@ class MangaPlus(
|
||||
}
|
||||
|
||||
val titleDetailView = result.success.titleDetailView!!
|
||||
val subtitleOnly = preferences.subtitleOnly()
|
||||
|
||||
return titleDetailView.chapterList
|
||||
.filterNot(Chapter::isExpired)
|
||||
.map(Chapter::toSChapter)
|
||||
.map { it.toSChapter(subtitleOnly) }
|
||||
.reversed()
|
||||
}
|
||||
|
||||
@ -303,8 +304,8 @@ class MangaPlus(
|
||||
private fun pageListRequest(chapterId: String): Request {
|
||||
val url = "$API_URL/manga_viewer".toHttpUrl().newBuilder()
|
||||
.addQueryParameter("chapter_id", chapterId)
|
||||
.addQueryParameter("split", if (preferences.splitImages) "yes" else "no")
|
||||
.addQueryParameter("img_quality", preferences.imageQuality)
|
||||
.addQueryParameter("split", if (preferences.splitImages()) "yes" else "no")
|
||||
.addQueryParameter("img_quality", preferences.imageQuality())
|
||||
.addQueryParameter("format", "json")
|
||||
.toString()
|
||||
|
||||
@ -355,8 +356,16 @@ class MangaPlus(
|
||||
setDefaultValue(SPLIT_PREF_DEFAULT_VALUE)
|
||||
}
|
||||
|
||||
val titlePref = SwitchPreferenceCompat(screen.context).apply {
|
||||
key = "${SUBTITLE_ONLY_KEY}_$lang"
|
||||
title = intl["subtitle_only"]
|
||||
summary = intl["subtitle_only_summary"]
|
||||
setDefaultValue(SUBTITLE_ONLY_DEFAULT_VALUE)
|
||||
}
|
||||
|
||||
screen.addPreference(qualityPref)
|
||||
screen.addPreference(splitPref)
|
||||
screen.addPreference(titlePref)
|
||||
}
|
||||
|
||||
private fun imageIntercept(chain: Interceptor.Chain): Response {
|
||||
@ -412,11 +421,11 @@ class MangaPlus(
|
||||
json.decodeFromString(body.string())
|
||||
}
|
||||
|
||||
private val SharedPreferences.imageQuality: String
|
||||
get() = getString("${QUALITY_PREF_KEY}_$lang", QUALITY_PREF_DEFAULT_VALUE)!!
|
||||
private fun SharedPreferences.imageQuality(): String = getString("${QUALITY_PREF_KEY}_$lang", QUALITY_PREF_DEFAULT_VALUE)!!
|
||||
|
||||
private val SharedPreferences.splitImages: Boolean
|
||||
get() = getBoolean("${SPLIT_PREF_KEY}_$lang", SPLIT_PREF_DEFAULT_VALUE)
|
||||
private fun SharedPreferences.splitImages(): Boolean = getBoolean("${SPLIT_PREF_KEY}_$lang", SPLIT_PREF_DEFAULT_VALUE)
|
||||
|
||||
private fun SharedPreferences.subtitleOnly(): Boolean = getBoolean("${SUBTITLE_ONLY_KEY}_$lang", SUBTITLE_ONLY_DEFAULT_VALUE)
|
||||
|
||||
companion object {
|
||||
const val PREFIX_ID_SEARCH = "id:"
|
||||
@ -437,6 +446,9 @@ private val QUALITY_PREF_DEFAULT_VALUE = QUALITY_PREF_ENTRY_VALUES[2]
|
||||
private const val SPLIT_PREF_KEY = "splitImage"
|
||||
private const val SPLIT_PREF_DEFAULT_VALUE = true
|
||||
|
||||
private const val SUBTITLE_ONLY_KEY = "subtitleOnly"
|
||||
private const val SUBTITLE_ONLY_DEFAULT_VALUE = false
|
||||
|
||||
private const val NOT_FOUND_SUBJECT = "Not Found"
|
||||
|
||||
private const val TITLE_THUMBNAIL_PATH = "title_thumbnail_portrait_list"
|
||||
|
@ -314,11 +314,16 @@ class Chapter(
|
||||
val isExpired: Boolean
|
||||
get() = subTitle == null
|
||||
|
||||
fun toSChapter(): SChapter = SChapter.create().apply {
|
||||
name = "${this@Chapter.name} - $subTitle"
|
||||
fun toSChapter(subtitlePref: Boolean): SChapter = SChapter.create().apply {
|
||||
name = if (subtitlePref && subTitle != null) {
|
||||
subTitle
|
||||
} else {
|
||||
"${this@Chapter.name} - $subTitle"
|
||||
}
|
||||
date_upload = 1000L * startTimeStamp
|
||||
url = "#/viewer/$chapterId"
|
||||
chapter_number = this@Chapter.name.substringAfter("#").toFloatOrNull() ?: -1f
|
||||
scanlator = "MANGA Plus"
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user