mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-09 05:25:08 +01:00
Allow manhwas to be read in non webtoon formats
but only them. Webtoons will still force webtoon mode It's about time for this anyway, not all sources can be mangadex but the original goal has been reached: force users libraries to webtoon for manhwa Now they can be free...ish Also some changes to the logic for series type
This commit is contained in:
parent
5c741e2fc5
commit
71e6c3132f
@ -86,6 +86,11 @@ interface Manga : SManga {
|
||||
isComicSource(sourceName)
|
||||
) {
|
||||
TYPE_COMIC
|
||||
} else if (sourceName.contains("webtoon", true) &&
|
||||
currentTags.none { tag -> isManhuaTag(tag) } &&
|
||||
currentTags.none { tag -> isManhwaTag(tag) }
|
||||
) {
|
||||
TYPE_WEBTOON
|
||||
} else if (currentTags.any { tag -> isManhuaTag(tag) } || sourceName.contains("manhua", true)
|
||||
) {
|
||||
TYPE_MANHUA
|
||||
@ -107,7 +112,7 @@ interface Manga : SManga {
|
||||
val currentTags = genre?.split(",")?.map { it.trim().toLowerCase(Locale.US) }
|
||||
return if (currentTags?.any
|
||||
{ tag ->
|
||||
tag == "long strip" || tag == "manhwa" || tag.contains("webtoon")
|
||||
isManhwaTag(tag) || tag.contains("webtoon")
|
||||
} == true || isWebtoonSource(sourceName)
|
||||
) {
|
||||
ReaderActivity.WEBTOON
|
||||
@ -130,6 +135,13 @@ interface Manga : SManga {
|
||||
return tag in listOf("manhua", "маньхуа", "cn", "hk", "zh-Hans", "zh-Hant") || tag.startsWith("chinese")
|
||||
}
|
||||
|
||||
fun isLongStrip(): Boolean {
|
||||
val currentTags =
|
||||
genre?.split(",")?.map { it.trim().toLowerCase(Locale.US) } ?: emptyList()
|
||||
val sourceName by lazy { Injekt.get<SourceManager>().getOrStub(source).name }
|
||||
return currentTags.any { it == "long strip" } || sourceName.contains("webtoon", true)
|
||||
}
|
||||
|
||||
fun isManhwaTag(tag: String): Boolean {
|
||||
return tag in listOf("long strip", "manhwa", "манхва", "kr") || tag.startsWith("korean")
|
||||
}
|
||||
@ -140,7 +152,7 @@ interface Manga : SManga {
|
||||
|
||||
fun isWebtoonSource(sourceName: String): Boolean {
|
||||
return sourceName.contains("webtoon", true) ||
|
||||
sourceName.contains("manwha", true) ||
|
||||
sourceName.contains("manhwa", true) ||
|
||||
sourceName.contains("toonily", true)
|
||||
}
|
||||
|
||||
|
@ -781,7 +781,7 @@ class ReaderActivity :
|
||||
),
|
||||
4000
|
||||
) {
|
||||
if (mangaViewer != WEBTOON) setAction(R.string.use_default) {
|
||||
if (presenter.manga?.isLongStrip() != true) setAction(R.string.use_default) {
|
||||
presenter.setMangaViewer(0)
|
||||
}
|
||||
}
|
||||
|
@ -560,7 +560,10 @@ class ReaderPresenter(
|
||||
val default = preferences.defaultViewer()
|
||||
val manga = manga ?: return default
|
||||
val readerType = manga.defaultReaderType()
|
||||
if (manga.viewer == -1 || (readerType == ReaderActivity.WEBTOON && readerType != manga.viewer)) {
|
||||
if (manga.viewer == -1 ||
|
||||
// Force webtoon mode
|
||||
(manga.isLongStrip() && readerType != manga.viewer)
|
||||
) {
|
||||
val cantSwitchToLTR =
|
||||
(readerType == ReaderActivity.LEFT_TO_RIGHT && default != ReaderActivity.RIGHT_TO_LEFT)
|
||||
manga.viewer = if (cantSwitchToLTR) 0 else readerType
|
||||
|
Loading…
Reference in New Issue
Block a user