mangadex add demographic (#341)

This commit is contained in:
Carlos 2018-06-02 20:46:12 -04:00 committed by GitHub
parent bb83944dd6
commit f5d6af2cce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -5,8 +5,8 @@ ext {
appName = 'Tachiyomi: MangaDex' appName = 'Tachiyomi: MangaDex'
pkgNameSuffix = "all.mangadex" pkgNameSuffix = "all.mangadex"
extClass = '.MangadexFactory' extClass = '.MangadexFactory'
extVersionCode = 25 extVersionCode = 26
extVersionSuffix = 25 extVersionSuffix = 26
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -165,12 +165,17 @@ open class Mangadex(override val lang: String, private val internalLang: String,
filters.forEach { filter -> filters.forEach { filter ->
when (filter) { when (filter) {
is TextField -> url.addQueryParameter(filter.key, filter.state) is TextField -> url.addQueryParameter(filter.key, filter.state)
is Demographic -> {
if (filter.state != 0) {
url.addQueryParameter("demo", filter.state.toString())
}
}
} }
} }
if (genres.isNotEmpty()) { if (genres.isNotEmpty()) {
url.addQueryParameter("genres", genres.joinToString(",")) url.addQueryParameter("genres", genres.joinToString(","))
} }
return GET(url.toString(), headers) return GET(url.toString(), headers)
} }
@ -389,11 +394,13 @@ open class Mangadex(override val lang: String, private val internalLang: String,
private class Genre(val id: String, name: String) : Filter.CheckBox(name) private class Genre(val id: String, name: String) : Filter.CheckBox(name)
private class GenreList(genres: List<Genre>) : Filter.Group<Genre>("Genres", genres) private class GenreList(genres: List<Genre>) : Filter.Group<Genre>("Genres", genres)
private class R18 : Filter.Select<String>("R18+", arrayOf("Show all", "Show only", "Show none")) private class R18 : Filter.Select<String>("R18+", arrayOf("Show all", "Show only", "Show none"))
private class Demographic : Filter.Select<String>("Demographic", arrayOf("All", "Shounen", "Shoujo", "Seinen", "Josei"))
override fun getFilterList() = FilterList( override fun getFilterList() = FilterList(
TextField("Author", "author"), TextField("Author", "author"),
TextField("Artist", "artist"), TextField("Artist", "artist"),
R18(), R18(),
Demographic(),
GenreList(getGenreList()) GenreList(getGenreList())
) )