From ab0d6aceabec71520e28407be8d4fd8bb9a008d5 Mon Sep 17 00:00:00 2001 From: iD-666 <139281826+iD-666@users.noreply.github.com> Date: Thu, 27 Jul 2023 19:34:10 +0700 Subject: [PATCH] Add a Status search filter and remove 1 deleted sort in Comick (#17269) * Add a Status filter and remove 1 deleted sort * Add Status filter * Update build.gradle --- src/all/comickfun/build.gradle | 2 +- .../extension/all/comickfun/ComickFun.kt | 3 +++ .../all/comickfun/ComickFunFilters.kt | 19 +++++++++++++++---- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/all/comickfun/build.gradle b/src/all/comickfun/build.gradle index f6faf543e..74b2604af 100644 --- a/src/all/comickfun/build.gradle +++ b/src/all/comickfun/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'Comick' pkgNameSuffix = 'all.comickfun' extClass = '.ComickFunFactory' - extVersionCode = 30 + extVersionCode = 31 isNsfw = true } diff --git a/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt b/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt index 51a7a8dd3..3f68481cb 100644 --- a/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt +++ b/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt @@ -166,6 +166,9 @@ abstract class ComickFun( is SortFilter -> { addQueryParameter("sort", it.getValue()) } + is StatusFilter -> { + addQueryParameter("status", it.getValue()) + } is CreatedAtFilter -> { if (it.state > 0) { addQueryParameter("time", it.getValue()) diff --git a/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFunFilters.kt b/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFunFilters.kt index 1b256a231..3d6f70220 100644 --- a/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFunFilters.kt +++ b/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFunFilters.kt @@ -5,13 +5,14 @@ import eu.kanade.tachiyomi.source.model.FilterList fun getFilters(): FilterList { return FilterList( - Filter.Header(name = "NOTE: Everything below is ignored if using text search"), - CompletedFilter("Completed translation"), + Filter.Header(name = "The filter is ignored when using text search."), GenreFilter("Genre", getGenresList), DemographicFilter("Demographic", getDemographicList), TypeFilter("Type", getTypeList), SortFilter("Sort", getSortsList), - CreatedAtFilter("Created At", getCreatedAtList), + StatusFilter("Status", getStatusList), + CompletedFilter("Completely Scanlated?"), + CreatedAtFilter("Created at", getCreatedAtList), MinimumFilter("Minimum Chapters"), Filter.Header("From Year, ex: 2010"), FromYearFilter("From"), @@ -48,6 +49,9 @@ internal class ToYearFilter(name: String) : Text(name) internal class SortFilter(name: String, sortList: Array>, state: Int = 0) : Select(name, sortList, state) +internal class StatusFilter(name: String, statusList: Array>, state: Int = 0) : + Select(name, statusList, state) + /** Generics **/ internal open class Group(name: String, values: List) : Filter.Group(name, values) @@ -174,10 +178,17 @@ private val getCreatedAtList: Array> = arrayOf( ) private val getSortsList: Array> = arrayOf( - Pair("Most popular", "follow"), Pair("Most follows", "user_follow_count"), Pair("Most views", "view"), Pair("High rating", "rating"), Pair("Last updated", "uploaded"), Pair("Newest", "created_at"), ) + +private val getStatusList: Array> = arrayOf( + Pair("All", ""), + Pair("Ongoing", "1"), + Pair("Completed", "2"), + Pair("Cancelled", "3"), + Pair("Hiatus", "4"), +)