Colored Manga | Fix Latest, Pages Count, Fix Title Search (#4619)

* Fix Latest, Pages Count, Fix Title Search

- "Newest" is now a new Filter that sorts by manga first upload date
- Latest Updates fixed -> date parsed from latest manga chapter date, not manga upload date
This commit is contained in:
KenjieDec 2024-08-14 18:36:19 +07:00 committed by GitHub
parent 9d3edbb49c
commit 7f3a7e22e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 26 additions and 5 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'ColoredManga'
extClass = '.ColoredManga'
extVersionCode = 35
extVersionCode = 36
isNsfw = true
}

View File

@ -139,7 +139,8 @@ class ColoredManga : HttpSource() {
val includeColor = colorIncluded.isEmpty() || colorIncluded.contains(it.version)
val excludeColor = colorExcluded.isNotEmpty() && colorExcluded.contains(it.version)
val regularSearch = it.name.contains(title) || it.synopsis.contains(title)
val regularSearch = it.name.contains(title, true) || it.synopsis.contains(title, true)
includeGenre && !excludeGenre &&
includeType && !excludeType &&
includeColor && !excludeColor &&
@ -161,7 +162,7 @@ class ColoredManga : HttpSource() {
mangas.sortedBy { it.name }
}
}
else -> {
"new" -> {
if (sort.second == "desc") {
mangas.sortedByDescending {
try {
@ -180,6 +181,25 @@ class ColoredManga : HttpSource() {
}
}
}
else -> {
if (sort.second == "desc") {
mangas.sortedByDescending {
try {
dateFormat.parse(it.chapters.last().date)!!.time
} catch (e: Exception) {
0L
}
}
} else {
mangas.sortedBy {
try {
dateFormat.parse(it.chapters.last().date)!!.time
} catch (e: Exception) {
0L
}
}
}
}
}
val final = sorted.map(::popularManga)
@ -360,7 +380,7 @@ class ColoredManga : HttpSource() {
val chapterJson = spChapter!!.toJson()
return Observable.just(
List(spChapter.totalImage - 1) {
List(spChapter.totalImage) {
val url = "https://127.0.0.1/#${it + 1}+${manga.name}"
val volumeInfo = if (volumes) {
manga.volume.find { vol -> vol.chapters.any { chap -> chap.number == chapter.name } }

View File

@ -56,7 +56,8 @@ internal open class SortFilter(name: String, selection: Selection, private val v
}
private val getSortsList: List<Pair<String, String>> = listOf(
Pair("Newest", "lat"),
Pair("Last Updated", "lat"),
Pair("Newest", "new"),
Pair("Popularity", "pop"),
Pair("Title", "tit"),
)