feat: 18+ media on infinite scroll too

This commit is contained in:
aayush262 2024-04-01 19:31:32 +05:30
parent 0d8a82568a
commit a815bac15d
4 changed files with 18 additions and 13 deletions

View file

@ -894,6 +894,7 @@ class AnilistQueries {
season: String? = null, season: String? = null,
id: Int? = null, id: Int? = null,
hd: Boolean = false, hd: Boolean = false,
adultOnly: Boolean = false
): SearchResults? { ): SearchResults? {
val query = """ val query = """
query (${"$"}page: Int = 1, ${"$"}id: Int, ${"$"}type: MediaType, ${"$"}isAdult: Boolean = false, ${"$"}search: String, ${"$"}format: [MediaFormat], ${"$"}status: MediaStatus, ${"$"}countryOfOrigin: CountryCode, ${"$"}source: MediaSource, ${"$"}season: MediaSeason, ${"$"}seasonYear: Int, ${"$"}year: String, ${"$"}onList: Boolean, ${"$"}yearLesser: FuzzyDateInt, ${"$"}yearGreater: FuzzyDateInt, ${"$"}episodeLesser: Int, ${"$"}episodeGreater: Int, ${"$"}durationLesser: Int, ${"$"}durationGreater: Int, ${"$"}chapterLesser: Int, ${"$"}chapterGreater: Int, ${"$"}volumeLesser: Int, ${"$"}volumeGreater: Int, ${"$"}licensedBy: [String], ${"$"}isLicensed: Boolean, ${"$"}genres: [String], ${"$"}excludedGenres: [String], ${"$"}tags: [String], ${"$"}excludedTags: [String], ${"$"}minimumTagRank: Int, ${"$"}sort: [MediaSort] = [POPULARITY_DESC, SCORE_DESC]) { query (${"$"}page: Int = 1, ${"$"}id: Int, ${"$"}type: MediaType, ${"$"}isAdult: Boolean = false, ${"$"}search: String, ${"$"}format: [MediaFormat], ${"$"}status: MediaStatus, ${"$"}countryOfOrigin: CountryCode, ${"$"}source: MediaSource, ${"$"}season: MediaSeason, ${"$"}seasonYear: Int, ${"$"}year: String, ${"$"}onList: Boolean, ${"$"}yearLesser: FuzzyDateInt, ${"$"}yearGreater: FuzzyDateInt, ${"$"}episodeLesser: Int, ${"$"}episodeGreater: Int, ${"$"}durationLesser: Int, ${"$"}durationGreater: Int, ${"$"}chapterLesser: Int, ${"$"}chapterGreater: Int, ${"$"}volumeLesser: Int, ${"$"}volumeGreater: Int, ${"$"}licensedBy: [String], ${"$"}isLicensed: Boolean, ${"$"}genres: [String], ${"$"}excludedGenres: [String], ${"$"}tags: [String], ${"$"}excludedTags: [String], ${"$"}minimumTagRank: Int, ${"$"}sort: [MediaSort] = [POPULARITY_DESC, SCORE_DESC]) {
@ -941,6 +942,7 @@ query (${"$"}page: Int = 1, ${"$"}id: Int, ${"$"}type: MediaType, ${"$"}isAdult:
} }
""".replace("\n", " ").replace(""" """, "") """.replace("\n", " ").replace(""" """, "")
val variables = """{"type":"$type","isAdult":$isAdult val variables = """{"type":"$type","isAdult":$isAdult
${if (adultOnly) ""","isAdult":true""" else ""}
${if (onList != null) ""","onList":$onList""" else ""} ${if (onList != null) ""","onList":$onList""" else ""}
${if (page != null) ""","page":"$page"""" else ""} ${if (page != null) ""","page":"$page"""" else ""}
${if (id != null) ""","id":"$id"""" else ""} ${if (id != null) ""","id":"$id"""" else ""}

View file

@ -137,7 +137,8 @@ class AnilistAnimeViewModel : ViewModel() {
sort = Anilist.sortBy[2], sort = Anilist.sortBy[2],
season = season, season = season,
seasonYear = year, seasonYear = year,
hd = true hd = true,
adultOnly = PrefManager.getVal(PrefName.AdultOnly)
)?.results )?.results
) )
} }
@ -159,7 +160,8 @@ class AnilistAnimeViewModel : ViewModel() {
search = searchVal, search = searchVal,
onList = if (onList) null else false, onList = if (onList) null else false,
sort = sort, sort = sort,
genres = genres genres = genres,
adultOnly = PrefManager.getVal(PrefName.AdultOnly)
) )
) )
} }
@ -176,7 +178,8 @@ class AnilistAnimeViewModel : ViewModel() {
r.tags, r.tags,
r.format, r.format,
r.isAdult, r.isAdult,
r.onList r.onList,
adultOnly = PrefManager.getVal(PrefName.AdultOnly),
) )
) )
@ -241,7 +244,8 @@ class AnilistMangaViewModel : ViewModel() {
type, type,
perPage = 10, perPage = 10,
sort = Anilist.sortBy[2], sort = Anilist.sortBy[2],
hd = true hd = true,
adultOnly = PrefManager.getVal(PrefName.AdultOnly)
)?.results )?.results
) )
@ -261,7 +265,8 @@ class AnilistMangaViewModel : ViewModel() {
search = searchVal, search = searchVal,
onList = if (onList) null else false, onList = if (onList) null else false,
sort = sort, sort = sort,
genres = genres genres = genres,
adultOnly = PrefManager.getVal(PrefName.AdultOnly)
) )
) )
} }
@ -282,7 +287,8 @@ class AnilistMangaViewModel : ViewModel() {
r.excludedGenres, r.excludedGenres,
r.excludedTags, r.excludedTags,
r.seasonYear, r.seasonYear,
r.season r.season,
adultOnly = PrefManager.getVal(PrefName.AdultOnly)
) )
) )
@ -342,7 +348,7 @@ class AnilistSearch : ViewModel() {
r.excludedGenres, r.excludedGenres,
r.excludedTags, r.excludedTags,
r.seasonYear, r.seasonYear,
r.season r.season,
) )
) )

View file

@ -1,14 +1,13 @@
package ani.dantotsu.profile.activity package ani.dantotsu.profile
import android.content.Intent import android.content.Intent
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import ani.dantotsu.blurImage
import ani.dantotsu.databinding.ItemFollowerBinding import ani.dantotsu.databinding.ItemFollowerBinding
import ani.dantotsu.loadImage import ani.dantotsu.loadImage
import ani.dantotsu.profile.ProfileActivity
import ani.dantotsu.profile.User
import ani.dantotsu.setAnimation import ani.dantotsu.setAnimation
@ -41,7 +40,7 @@ class UsersAdapter(private val user: ArrayList<User>) : RecyclerView.Adapter<Use
setAnimation(b.root.context, b.root) setAnimation(b.root.context, b.root)
val user = user[position] val user = user[position]
b.profileUserAvatar.loadImage(user.pfp) b.profileUserAvatar.loadImage(user.pfp)
b.profileBannerImage.loadImage(user.banner) blurImage(b.profileBannerImage, user.banner ?: user.pfp)
b.profileUserName.text = user.name b.profileUserName.text = user.name
} }

View file

@ -7,8 +7,6 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import ani.dantotsu.BottomSheetDialogFragment import ani.dantotsu.BottomSheetDialogFragment
import ani.dantotsu.databinding.BottomSheetUsersBinding import ani.dantotsu.databinding.BottomSheetUsersBinding
import ani.dantotsu.profile.activity.UsersAdapter
import ani.dantotsu.settings.DevelopersAdapter
class UsersDialogFragment : BottomSheetDialogFragment() { class UsersDialogFragment : BottomSheetDialogFragment() {