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
20b3c8ac86
commit
f8ab0d3f2f
|
@ -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 = 52
|
||||
extVersionCode = 53
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
|
|
@ -289,9 +289,10 @@ class MangaPlus(
|
|||
}
|
||||
|
||||
val titleDetailView = result.success.titleDetailView!!
|
||||
val subtitleOnly = preferences.subtitleOnly()
|
||||
|
||||
return titleDetailView.chapterList
|
||||
.map(Chapter::toSChapter)
|
||||
.map { it.toSChapter(subtitleOnly) }
|
||||
.reversed()
|
||||
}
|
||||
|
||||
|
@ -307,8 +308,8 @@ class MangaPlus(
|
|||
private fun pageListRequest(chapterId: String): Request {
|
||||
val url = "$APP_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("ticket_reading", "no")
|
||||
.addQueryParameter("free_reading", "yes")
|
||||
.addQueryParameter("subscription_reading", "no")
|
||||
|
@ -378,8 +379,16 @@ class MangaPlus(
|
|||
key = "${VER_PREF_KEY}_$lang",
|
||||
)
|
||||
|
||||
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 PreferenceScreen.addEditTextPreference(
|
||||
|
@ -494,11 +503,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)
|
||||
|
||||
private val SharedPreferences.appVersion: String?
|
||||
get() = getString("${VER_PREF_KEY}_$lang", VER_PREF_DEFAULT_VALUE)
|
||||
|
@ -526,6 +535,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 VER_PREF_KEY = "appVer"
|
||||
private const val VER_PREF_DEFAULT_VALUE = ""
|
||||
private const val SECRET_PREF_KEY = "accountSecret"
|
||||
|
|
|
@ -322,11 +322,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