GocTruyenTranh edit 2 search filter (#7339)

* Update filter

* Update GocTruyenTranh.kt
This commit is contained in:
are-are-are 2025-02-01 19:32:19 +07:00 committed by Draff
parent 701b46e29a
commit f4780ecb11
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
2 changed files with 14 additions and 8 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'Goc Truyen Tranh' extName = 'Goc Truyen Tranh'
extClass = '.GocTruyenTranh' extClass = '.GocTruyenTranh'
extVersionCode = 1 extVersionCode = 2
isNsfw = true isNsfw = true
} }

View File

@ -143,10 +143,10 @@ class GocTruyenTranh : ParsedHttpSource(), ConfigurableSource {
.map { it.id } .map { it.id }
.forEach { addQueryParameter("status", it) } .forEach { addQueryParameter("status", it) }
is ChapterCountList -> is ChapterCountList ->
filter.state {
.filter { it.state } val chapterCount = getChapterCountList()[filter.state]
.map { it.id } addQueryParameter("minChap", chapterCount.id)
.forEach { addQueryParameter("minChap", it) } }
is SortByList -> is SortByList ->
{ {
val sort = getSortByList()[filter.state] val sort = getSortByList()[filter.state]
@ -185,8 +185,12 @@ class GocTruyenTranh : ParsedHttpSource(), ConfigurableSource {
private class StatusList(status: List<Status>) : Filter.Group<Status>("Trạng Thái", status) private class StatusList(status: List<Status>) : Filter.Group<Status>("Trạng Thái", status)
private class Status(name: String, val id: String) : Filter.CheckBox(name) private class Status(name: String, val id: String) : Filter.CheckBox(name)
private class ChapterCountList(chapter: List<ChapterCount>) : Filter.Group<ChapterCount>("Độ dài", chapter) private class ChapterCountList(chapter: Array<ChapterCount>) : Filter.Select<ChapterCount>("Độ dài", chapter)
private class ChapterCount(name: String, val id: String) : Filter.CheckBox(name) private class ChapterCount(name: String, val id: String) : Filter.CheckBox(name) {
override fun toString(): String {
return name
}
}
private class SortByList(sort: Array<SortBy>) : Filter.Select<SortBy>("Sắp xếp", sort) private class SortByList(sort: Array<SortBy>) : Filter.Select<SortBy>("Sắp xếp", sort)
private class SortBy(name: String, val id: String) : Filter.CheckBox(name) { private class SortBy(name: String, val id: String) : Filter.CheckBox(name) {
@ -212,6 +216,7 @@ class GocTruyenTranh : ParsedHttpSource(), ConfigurableSource {
Country("Khác", "other"), Country("Khác", "other"),
) )
private fun getSortByList() = arrayOf( private fun getSortByList() = arrayOf(
SortBy("Không", ""),
SortBy("Mới nhất", "latest"), SortBy("Mới nhất", "latest"),
SortBy("Cũ nhất", "oldest"), SortBy("Cũ nhất", "oldest"),
SortBy("Đánh giá", "rating"), SortBy("Đánh giá", "rating"),
@ -219,7 +224,8 @@ class GocTruyenTranh : ParsedHttpSource(), ConfigurableSource {
SortBy("Mới cập nhật", "recently_updated"), SortBy("Mới cập nhật", "recently_updated"),
SortBy("Xem nhiều nhất", "mostView"), SortBy("Xem nhiều nhất", "mostView"),
) )
private fun getChapterCountList() = listOf( private fun getChapterCountList() = arrayOf(
ChapterCount("Không", ""),
ChapterCount(">= 1 chapters", "1"), ChapterCount(">= 1 chapters", "1"),
ChapterCount(">= 3 chapters", "3"), ChapterCount(">= 3 chapters", "3"),
ChapterCount(">= 5 chapters", "5"), ChapterCount(">= 5 chapters", "5"),