diff --git a/src/en/mangaowl/build.gradle b/src/en/mangaowl/build.gradle index 0d817e49c..a4474f914 100644 --- a/src/en/mangaowl/build.gradle +++ b/src/en/mangaowl/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'MangaOwl' pkgNameSuffix = 'en.mangaowl' extClass = '.MangaOwl' - extVersionCode = 21 + extVersionCode = 22 libVersion = '1.2' } diff --git a/src/en/mangaowl/src/eu/kanade/tachiyomi/extension/en/mangaowl/MangaOwl.kt b/src/en/mangaowl/src/eu/kanade/tachiyomi/extension/en/mangaowl/MangaOwl.kt index 6cd94d235..9775c6317 100644 --- a/src/en/mangaowl/src/eu/kanade/tachiyomi/extension/en/mangaowl/MangaOwl.kt +++ b/src/en/mangaowl/src/eu/kanade/tachiyomi/extension/en/mangaowl/MangaOwl.kt @@ -90,13 +90,18 @@ class MangaOwl : ParsedHttpSource() { filters.forEach { filter -> when (filter) { - is SearchFilter -> url.addQueryParameter("search_field", filter.toUriPart()) + is SearchFieldFilter -> { + val fields = filter.state + .filter { it.state } + .joinToString("") { it.uriPart } + url.addQueryParameter("search_field", fields) + } is SortFilter -> url.addQueryParameter("sort", filter.toUriPart()) is StatusFilter -> url.addQueryParameter("completed", filter.toUriPart()) is GenreFilter -> { val genres = filter.state .filter { it.state } - .joinToString(".") { it.uriPart } + .joinToString(",") { it.uriPart } url.addQueryParameter("genres", genres) } is MinChapterFilter -> url.addQueryParameter("chapter_from", filter.state) @@ -181,7 +186,7 @@ class MangaOwl : ParsedHttpSource() { // Filters override fun getFilterList() = FilterList( - SearchFilter(), + SearchFieldFilter(getSearchFields()), SortFilter(), StatusFilter(), GenreFilter(getGenreList()), @@ -196,16 +201,6 @@ class MangaOwl : ParsedHttpSource() { fun toUriPart() = vals[state].second } - private class SearchFilter : UriPartFilter( - "Search in", - arrayOf( - Pair("Manga title", "1"), - Pair("Authors", "2"), - Pair("Description", "3"), - Pair("All", "123") - ) - ) - private class SortFilter : UriPartFilter( "Sort by", arrayOf( @@ -339,6 +334,15 @@ class MangaOwl : ParsedHttpSource() { Genre("Zombies", "108") ) + private class SearchField(name: String, state: Boolean, val uriPart: String) : Filter.CheckBox(name, state) + private class SearchFieldFilter(fields: List) : Filter.Group("Search in", fields) + + private fun getSearchFields() = listOf( + SearchField("Manga title", true, "1"), + SearchField("Authors", true, "2"), + SearchField("Description", false, "3") + ) + private class MinChapterFilter : Filter.Text("Minimum Chapters") private class MaxChapterFilter : Filter.Text("Maximum Chapters") }