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 Draff
parent 4060738822
commit 5d82449b0c
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
3 changed files with 26 additions and 5 deletions

View File

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

View File

@ -139,7 +139,8 @@ class ColoredManga : HttpSource() {
val includeColor = colorIncluded.isEmpty() || colorIncluded.contains(it.version) val includeColor = colorIncluded.isEmpty() || colorIncluded.contains(it.version)
val excludeColor = colorExcluded.isNotEmpty() && colorExcluded.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 && includeGenre && !excludeGenre &&
includeType && !excludeType && includeType && !excludeType &&
includeColor && !excludeColor && includeColor && !excludeColor &&
@ -161,7 +162,7 @@ class ColoredManga : HttpSource() {
mangas.sortedBy { it.name } mangas.sortedBy { it.name }
} }
} }
else -> { "new" -> {
if (sort.second == "desc") { if (sort.second == "desc") {
mangas.sortedByDescending { mangas.sortedByDescending {
try { 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) val final = sorted.map(::popularManga)
@ -360,7 +380,7 @@ class ColoredManga : HttpSource() {
val chapterJson = spChapter!!.toJson() val chapterJson = spChapter!!.toJson()
return Observable.just( return Observable.just(
List(spChapter.totalImage - 1) { List(spChapter.totalImage) {
val url = "https://127.0.0.1/#${it + 1}+${manga.name}" val url = "https://127.0.0.1/#${it + 1}+${manga.name}"
val volumeInfo = if (volumes) { val volumeInfo = if (volumes) {
manga.volume.find { vol -> vol.chapters.any { chap -> chap.number == chapter.name } } 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( private val getSortsList: List<Pair<String, String>> = listOf(
Pair("Newest", "lat"), Pair("Last Updated", "lat"),
Pair("Newest", "new"),
Pair("Popularity", "pop"), Pair("Popularity", "pop"),
Pair("Title", "tit"), Pair("Title", "tit"),
) )