mirror of
https://github.com/rebelonion/Dantotsu.git
synced 2026-01-20 19:03:56 +00:00
feat: attempt to add backend for countryOfOrigin filter
This commit is contained in:
@@ -883,6 +883,7 @@ class AnilistQueries {
|
||||
tags: MutableList<String>? = null,
|
||||
status: String? = null,
|
||||
format: String? = null,
|
||||
countryOfOrigin: String? = null,
|
||||
isAdult: Boolean = false,
|
||||
onList: Boolean? = null,
|
||||
excludedGenres: MutableList<String>? = null,
|
||||
@@ -947,6 +948,7 @@ query (${"$"}page: Int = 1, ${"$"}id: Int, ${"$"}type: MediaType, ${"$"}isAdult:
|
||||
${if (sort != null) ""","sort":"$sort"""" else ""}
|
||||
${if (status != null) ""","status":"$status"""" else ""}
|
||||
${if (format != null) ""","format":"${format.replace(" ", "_")}"""" else ""}
|
||||
${if (countryOfOrigin != null) ""","sort":"$sort"""" else ""}
|
||||
${if (genres?.isNotEmpty() == true) ""","genres":[${genres.joinToString { "\"$it\"" }}]""" else ""}
|
||||
${
|
||||
if (excludedGenres?.isNotEmpty() == true)
|
||||
@@ -1012,6 +1014,7 @@ query (${"$"}page: Int = 1, ${"$"}id: Int, ${"$"}type: MediaType, ${"$"}isAdult:
|
||||
excludedTags = excludedTags,
|
||||
status = status,
|
||||
format = format,
|
||||
countryOfOrigin = countryOfOrigin,
|
||||
seasonYear = seasonYear,
|
||||
season = season,
|
||||
results = responseArray,
|
||||
|
||||
@@ -187,6 +187,7 @@ class AnilistAnimeViewModel : ViewModel() {
|
||||
r.tags,
|
||||
r.status,
|
||||
r.format,
|
||||
r.countryOfOrigin,
|
||||
r.isAdult,
|
||||
r.onList
|
||||
)
|
||||
@@ -260,6 +261,7 @@ class AnilistMangaViewModel : ViewModel() {
|
||||
r.tags,
|
||||
r.status,
|
||||
r.format,
|
||||
r.countryOfOrigin,
|
||||
r.isAdult,
|
||||
r.onList,
|
||||
r.excludedGenres,
|
||||
@@ -290,6 +292,7 @@ class AnilistSearch : ViewModel() {
|
||||
r.tags,
|
||||
r.status,
|
||||
r.format,
|
||||
r.countryOfOrigin,
|
||||
r.isAdult,
|
||||
r.onList,
|
||||
r.excludedGenres,
|
||||
@@ -310,6 +313,7 @@ class AnilistSearch : ViewModel() {
|
||||
r.tags,
|
||||
r.status,
|
||||
r.format,
|
||||
r.countryOfOrigin,
|
||||
r.isAdult,
|
||||
r.onList,
|
||||
r.excludedGenres,
|
||||
|
||||
@@ -11,6 +11,7 @@ data class SearchResults(
|
||||
var onList: Boolean? = null,
|
||||
var perPage: Int? = null,
|
||||
var search: String? = null,
|
||||
var countryOfOrigin :String? = null,
|
||||
var sort: String? = null,
|
||||
var genres: MutableList<String>? = null,
|
||||
var excludedGenres: MutableList<String>? = null,
|
||||
@@ -44,6 +45,9 @@ data class SearchResults(
|
||||
format?.let {
|
||||
list.add(SearchChip("FORMAT", currContext()!!.getString(R.string.filter_format, it)))
|
||||
}
|
||||
countryOfOrigin?.let {
|
||||
list.add(SearchChip("COUNTRY", currContext()!!.getString(R.string.filter_country, it)))
|
||||
}
|
||||
season?.let {
|
||||
list.add(SearchChip("SEASON", it))
|
||||
}
|
||||
@@ -80,6 +84,7 @@ data class SearchResults(
|
||||
"SORT" -> sort = null
|
||||
"STATUS" -> status = null
|
||||
"FORMAT" -> format = null
|
||||
"COUNTRY" -> countryOfOrigin = null
|
||||
"SEASON" -> season = null
|
||||
"SEASON_YEAR" -> seasonYear = null
|
||||
"GENRE" -> genres?.remove(chip.text)
|
||||
|
||||
@@ -68,6 +68,7 @@ class SearchActivity : AppCompatActivity() {
|
||||
tags = intent.getStringExtra("tag")?.let { mutableListOf(it) },
|
||||
sort = intent.getStringExtra("sortBy"),
|
||||
status = intent.getStringExtra("status"),
|
||||
countryOfOrigin = intent.getStringExtra("country"),
|
||||
season = intent.getStringExtra("season"),
|
||||
seasonYear = intent.getStringExtra("seasonYear")?.toIntOrNull(),
|
||||
results = mutableListOf(),
|
||||
@@ -131,6 +132,7 @@ class SearchActivity : AppCompatActivity() {
|
||||
seasonYear = it.seasonYear
|
||||
status = it.status
|
||||
format = it.format
|
||||
countryOfOrigin = it.countryOfOrigin
|
||||
page = it.page
|
||||
hasNextPage = it.hasNextPage
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ class SearchFilterBottomDialog : BottomSheetDialogFragment() {
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private lateinit var activity: SearchActivity
|
||||
private var selectedCountry: String? = null
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
@@ -74,7 +73,7 @@ class SearchFilterBottomDialog : BottomSheetDialogFragment() {
|
||||
activity.result.sort = null
|
||||
binding.sortByFilter.setImageResource(R.drawable.ic_round_filter_alt_24)
|
||||
startBounceZoomAnimation(binding.sortByFilter)
|
||||
selectedCountry = null
|
||||
activity.result.countryOfOrigin = null
|
||||
binding.countryFilter.setImageResource(R.drawable.ic_round_globe_search_googlefonts)
|
||||
startBounceZoomAnimation(binding.countryFilter)
|
||||
|
||||
@@ -194,22 +193,22 @@ class SearchFilterBottomDialog : BottomSheetDialogFragment() {
|
||||
popupMenu.setOnMenuItemClickListener { menuItem ->
|
||||
when (menuItem.itemId) {
|
||||
R.id.country_china -> {
|
||||
selectedCountry = "China"
|
||||
activity.result.countryOfOrigin = "CN"
|
||||
binding.countryFilter.setImageResource(R.drawable.ic_round_globe_china_googlefonts)
|
||||
startBounceZoomAnimation(binding.countryFilter)
|
||||
}
|
||||
R.id.country_south_korea -> {
|
||||
selectedCountry = "South Korea"
|
||||
activity.result.countryOfOrigin = "KR"
|
||||
binding.countryFilter.setImageResource(R.drawable.ic_round_globe_south_korea_googlefonts)
|
||||
startBounceZoomAnimation(binding.countryFilter)
|
||||
}
|
||||
R.id.country_japan -> {
|
||||
selectedCountry = "Japan"
|
||||
activity.result.countryOfOrigin = "JP"
|
||||
binding.countryFilter.setImageResource(R.drawable.ic_round_globe_japan_googlefonts)
|
||||
startBounceZoomAnimation(binding.countryFilter)
|
||||
}
|
||||
R.id.country_taiwan -> {
|
||||
selectedCountry = "Taiwan"
|
||||
activity.result.countryOfOrigin = "TW"
|
||||
binding.countryFilter.setImageResource(R.drawable.ic_round_globe_taiwan_googlefonts)
|
||||
startBounceZoomAnimation(binding.countryFilter)
|
||||
}
|
||||
@@ -226,6 +225,7 @@ class SearchFilterBottomDialog : BottomSheetDialogFragment() {
|
||||
season = binding.searchSeason.text.toString().ifBlank { null }
|
||||
seasonYear = binding.searchYear.text.toString().toIntOrNull()
|
||||
sort = activity.result.sort
|
||||
countryOfOrigin = activity.result.countryOfOrigin
|
||||
genres = selectedGenres
|
||||
tags = selectedTags
|
||||
excludedGenres = exGenres
|
||||
|
||||
@@ -615,6 +615,7 @@
|
||||
|
||||
<string name="filter_status">"Status : %1$s"</string>
|
||||
<string name="filter_format">"Format : %1$s"</string>
|
||||
<string name="filter_country">"Country : %1$s"</string>
|
||||
<string name="filter_sort">"Sort : %1$s"</string>
|
||||
<string name="filter_exclude">"Not %1$s"</string>
|
||||
<string name="search_by_image">Search by Image</string>
|
||||
|
||||
@@ -12,7 +12,7 @@ buildscript {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.3.1'
|
||||
classpath 'com.android.tools.build:gradle:8.3.0'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
||||
classpath "com.google.devtools.ksp:symbol-processing-api:$ksp_version"
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
#Wed Aug 30 19:57:04 IST 2023
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
Reference in New Issue
Block a user