mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
zoro stuff (1/2)
This commit is contained in:
parent
b7d90cad08
commit
fe2123c04a
16 changed files with 97 additions and 106 deletions
|
@ -323,12 +323,12 @@ data class AnimeSearchResponse(
|
||||||
override val type: TvType,
|
override val type: TvType,
|
||||||
|
|
||||||
override val posterUrl: String?,
|
override val posterUrl: String?,
|
||||||
val year: Int?,
|
val year: Int? = null,
|
||||||
|
|
||||||
val otherName: String?,
|
|
||||||
val dubStatus: EnumSet<DubStatus>?,
|
val dubStatus: EnumSet<DubStatus>?,
|
||||||
val dubEpisodes: Int?,
|
|
||||||
val subEpisodes: Int?,
|
val otherName: String? = null,
|
||||||
|
val dubEpisodes: Int? = null,
|
||||||
|
val subEpisodes: Int? = null,
|
||||||
override val id: Int? = null,
|
override val id: Int? = null,
|
||||||
) : SearchResponse
|
) : SearchResponse
|
||||||
|
|
||||||
|
|
|
@ -51,10 +51,7 @@ class AnimeFlickProvider : MainAPI() {
|
||||||
getType(title),
|
getType(title),
|
||||||
poster,
|
poster,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
EnumSet.of(DubStatus.Subbed),
|
EnumSet.of(DubStatus.Subbed),
|
||||||
null,
|
|
||||||
null
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,9 +93,9 @@ class AnimePaheProvider : MainAPI() {
|
||||||
TvType.Anime,
|
TvType.Anime,
|
||||||
it.snapshot,
|
it.snapshot,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
EnumSet.of(DubStatus.Subbed),
|
EnumSet.of(DubStatus.Subbed),
|
||||||
null,
|
null,
|
||||||
|
null,
|
||||||
it.episode
|
it.episode
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -159,9 +159,9 @@ class AnimePaheProvider : MainAPI() {
|
||||||
TvType.Anime,
|
TvType.Anime,
|
||||||
it.poster,
|
it.poster,
|
||||||
it.year,
|
it.year,
|
||||||
null,
|
|
||||||
EnumSet.of(DubStatus.Subbed),
|
EnumSet.of(DubStatus.Subbed),
|
||||||
null,
|
null,
|
||||||
|
null,
|
||||||
it.episodes
|
it.episodes
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -11,7 +11,6 @@ import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.getQualityFromName
|
import com.lagradost.cloudstream3.utils.getQualityFromName
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.collections.ArrayList
|
|
||||||
|
|
||||||
class DubbedAnimeProvider : MainAPI() {
|
class DubbedAnimeProvider : MainAPI() {
|
||||||
override val mainUrl: String
|
override val mainUrl: String
|
||||||
|
@ -76,10 +75,7 @@ class DubbedAnimeProvider : MainAPI() {
|
||||||
TvType.Anime,
|
TvType.Anime,
|
||||||
poster,
|
poster,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
EnumSet.of(DubStatus.Dubbed),
|
EnumSet.of(DubStatus.Dubbed),
|
||||||
null,
|
|
||||||
null
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,10 +94,7 @@ class DubbedAnimeProvider : MainAPI() {
|
||||||
TvType.Anime,
|
TvType.Anime,
|
||||||
poster,
|
poster,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
EnumSet.of(DubStatus.Dubbed),
|
EnumSet.of(DubStatus.Dubbed),
|
||||||
null,
|
|
||||||
null
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,10 +157,7 @@ class DubbedAnimeProvider : MainAPI() {
|
||||||
TvType.Anime,
|
TvType.Anime,
|
||||||
img,
|
img,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
EnumSet.of(DubStatus.Dubbed),
|
EnumSet.of(DubStatus.Dubbed),
|
||||||
null,
|
|
||||||
null
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -201,10 +191,7 @@ class DubbedAnimeProvider : MainAPI() {
|
||||||
TvType.Anime,
|
TvType.Anime,
|
||||||
img,
|
img,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
EnumSet.of(DubStatus.Dubbed),
|
EnumSet.of(DubStatus.Dubbed),
|
||||||
null,
|
|
||||||
null
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -79,6 +79,7 @@ class GogoanimeProvider : MainAPI() {
|
||||||
).text
|
).text
|
||||||
items.add(HomePageList(i.second, (parseRegex.findAll(html).map {
|
items.add(HomePageList(i.second, (parseRegex.findAll(html).map {
|
||||||
val (link, epNum, title, poster) = it.destructured
|
val (link, epNum, title, poster) = it.destructured
|
||||||
|
val isSub = listOf(1, 3).contains(i.first.toInt())
|
||||||
AnimeSearchResponse(
|
AnimeSearchResponse(
|
||||||
title,
|
title,
|
||||||
link,
|
link,
|
||||||
|
@ -86,12 +87,12 @@ class GogoanimeProvider : MainAPI() {
|
||||||
TvType.Anime,
|
TvType.Anime,
|
||||||
poster,
|
poster,
|
||||||
null,
|
null,
|
||||||
null,
|
if (isSub) EnumSet.of(DubStatus.Subbed) else EnumSet.of(
|
||||||
if (listOf(1, 3).contains(i.first.toInt())) EnumSet.of(DubStatus.Subbed) else EnumSet.of(
|
|
||||||
DubStatus.Dubbed
|
DubStatus.Dubbed
|
||||||
),
|
),
|
||||||
null,
|
null,
|
||||||
epNum.toIntOrNull()
|
if (!isSub) epNum.toIntOrNull() else null,
|
||||||
|
if (isSub) epNum.toIntOrNull() else null,
|
||||||
)
|
)
|
||||||
}).toList()))
|
}).toList()))
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
@ -115,12 +116,9 @@ class GogoanimeProvider : MainAPI() {
|
||||||
TvType.Anime,
|
TvType.Anime,
|
||||||
it.selectFirst("img").attr("src"),
|
it.selectFirst("img").attr("src"),
|
||||||
it.selectFirst(".released")?.text()?.split(":")?.getOrNull(1)?.trim()?.toIntOrNull(),
|
it.selectFirst(".released")?.text()?.split(":")?.getOrNull(1)?.trim()?.toIntOrNull(),
|
||||||
null,
|
|
||||||
if (it.selectFirst(".name").text().contains("Dub")) EnumSet.of(DubStatus.Dubbed) else EnumSet.of(
|
if (it.selectFirst(".name").text().contains("Dub")) EnumSet.of(DubStatus.Dubbed) else EnumSet.of(
|
||||||
DubStatus.Subbed
|
DubStatus.Subbed
|
||||||
),
|
),
|
||||||
null,
|
|
||||||
null
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,7 +234,7 @@ class GogoanimeProvider : MainAPI() {
|
||||||
val url = it.attr("href")
|
val url = it.attr("href")
|
||||||
val extractorLinks = ArrayList<ExtractorLink>()
|
val extractorLinks = ArrayList<ExtractorLink>()
|
||||||
for (api in extractorApis) {
|
for (api in extractorApis) {
|
||||||
if (url.startsWith(api.mainUrl) ) {
|
if (url.startsWith(api.mainUrl)) {
|
||||||
extractorLinks.addAll(api.getSafeUrl(url) ?: listOf())
|
extractorLinks.addAll(api.getSafeUrl(url) ?: listOf())
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,10 +37,7 @@ class KawaiifuProvider : MainAPI() {
|
||||||
TvType.Anime,
|
TvType.Anime,
|
||||||
it.selectFirst("img").attr("src"),
|
it.selectFirst("img").attr("src"),
|
||||||
it.selectFirst("h4 > a").attr("href").split("-").last().toIntOrNull(),
|
it.selectFirst("h4 > a").attr("href").split("-").last().toIntOrNull(),
|
||||||
null,
|
|
||||||
if (title.contains("(DUB)")) EnumSet.of(DubStatus.Dubbed) else EnumSet.of(DubStatus.Subbed),
|
if (title.contains("(DUB)")) EnumSet.of(DubStatus.Dubbed) else EnumSet.of(DubStatus.Subbed),
|
||||||
null,
|
|
||||||
null
|
|
||||||
)
|
)
|
||||||
}))
|
}))
|
||||||
for (section in soup.select(".section")) {
|
for (section in soup.select(".section")) {
|
||||||
|
@ -55,10 +52,7 @@ class KawaiifuProvider : MainAPI() {
|
||||||
TvType.Anime,
|
TvType.Anime,
|
||||||
ani.selectFirst("img").attr("src"),
|
ani.selectFirst("img").attr("src"),
|
||||||
ani.selectFirst(".vl-chil-date").text().toIntOrNull(),
|
ani.selectFirst(".vl-chil-date").text().toIntOrNull(),
|
||||||
null,
|
|
||||||
if (animTitle.contains("(DUB)")) EnumSet.of(DubStatus.Dubbed) else EnumSet.of(DubStatus.Subbed),
|
if (animTitle.contains("(DUB)")) EnumSet.of(DubStatus.Dubbed) else EnumSet.of(DubStatus.Subbed),
|
||||||
null,
|
|
||||||
null
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
items.add(HomePageList(title, anime))
|
items.add(HomePageList(title, anime))
|
||||||
|
@ -89,10 +83,7 @@ class KawaiifuProvider : MainAPI() {
|
||||||
TvType.Anime,
|
TvType.Anime,
|
||||||
poster,
|
poster,
|
||||||
year,
|
year,
|
||||||
null,
|
|
||||||
if (title.contains("(DUB)")) EnumSet.of(DubStatus.Dubbed) else EnumSet.of(DubStatus.Subbed),
|
if (title.contains("(DUB)")) EnumSet.of(DubStatus.Dubbed) else EnumSet.of(DubStatus.Subbed),
|
||||||
null,
|
|
||||||
null,
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,10 +66,7 @@ class TenshiProvider : MainAPI() {
|
||||||
TvType.Anime,
|
TvType.Anime,
|
||||||
it.selectFirst("img").attr("src"),
|
it.selectFirst("img").attr("src"),
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
EnumSet.of(DubStatus.Subbed),
|
EnumSet.of(DubStatus.Subbed),
|
||||||
null,
|
|
||||||
null
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
items.add(HomePageList(title, anime))
|
items.add(HomePageList(title, anime))
|
||||||
|
@ -84,10 +81,7 @@ class TenshiProvider : MainAPI() {
|
||||||
TvType.Anime,
|
TvType.Anime,
|
||||||
it.selectFirst("img").attr("src"),
|
it.selectFirst("img").attr("src"),
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
EnumSet.of(DubStatus.Subbed),
|
EnumSet.of(DubStatus.Subbed),
|
||||||
null,
|
|
||||||
null
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
items.add(HomePageList(title, anime))
|
items.add(HomePageList(title, anime))
|
||||||
|
@ -130,10 +124,7 @@ class TenshiProvider : MainAPI() {
|
||||||
TvType.Anime,
|
TvType.Anime,
|
||||||
img,
|
img,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
EnumSet.of(DubStatus.Subbed),
|
EnumSet.of(DubStatus.Subbed),
|
||||||
null,
|
|
||||||
null
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -63,10 +63,7 @@ class WatchCartoonOnlineProvider : MainAPI() {
|
||||||
TvType.Anime,
|
TvType.Anime,
|
||||||
poster,
|
poster,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
set,
|
set,
|
||||||
null,
|
|
||||||
null
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
package com.lagradost.cloudstream3.animeproviders
|
package com.lagradost.cloudstream3.animeproviders
|
||||||
|
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
|
||||||
import com.lagradost.cloudstream3.extractors.WcoStream
|
import com.lagradost.cloudstream3.extractors.WcoStream
|
||||||
import com.lagradost.cloudstream3.network.get
|
import com.lagradost.cloudstream3.network.get
|
||||||
import com.lagradost.cloudstream3.network.post
|
import com.lagradost.cloudstream3.network.post
|
||||||
import com.lagradost.cloudstream3.network.text
|
import com.lagradost.cloudstream3.network.text
|
||||||
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.collections.ArrayList
|
|
||||||
|
|
||||||
|
|
||||||
class WcoProvider : MainAPI() {
|
class WcoProvider : MainAPI() {
|
||||||
|
@ -64,7 +63,7 @@ class WcoProvider : MainAPI() {
|
||||||
val poster = filmPoster.selectFirst("> img").attr("data-src")
|
val poster = filmPoster.selectFirst("> img").attr("data-src")
|
||||||
val set: EnumSet<DubStatus> =
|
val set: EnumSet<DubStatus> =
|
||||||
EnumSet.of(if (isDub) DubStatus.Dubbed else DubStatus.Subbed)
|
EnumSet.of(if (isDub) DubStatus.Dubbed else DubStatus.Subbed)
|
||||||
AnimeSearchResponse(title, href, this.name, TvType.Anime, poster, null, null, set, null, null)
|
AnimeSearchResponse(title, href, this.name, TvType.Anime, poster,null, set)
|
||||||
}
|
}
|
||||||
items.add(HomePageList(i.second, results))
|
items.add(HomePageList(i.second, results))
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
@ -107,11 +106,8 @@ class WcoProvider : MainAPI() {
|
||||||
TvType.Anime,
|
TvType.Anime,
|
||||||
img,
|
img,
|
||||||
year,
|
year,
|
||||||
null,
|
|
||||||
EnumSet.of(if (isDub) DubStatus.Dubbed else DubStatus.Subbed),
|
EnumSet.of(if (isDub) DubStatus.Dubbed else DubStatus.Subbed),
|
||||||
null,
|
)
|
||||||
null
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -169,10 +165,7 @@ class WcoProvider : MainAPI() {
|
||||||
TvType.Anime,
|
TvType.Anime,
|
||||||
img,
|
img,
|
||||||
year,
|
year,
|
||||||
null,
|
|
||||||
EnumSet.of(if (isDub) DubStatus.Dubbed else DubStatus.Subbed),
|
EnumSet.of(if (isDub) DubStatus.Dubbed else DubStatus.Subbed),
|
||||||
null,
|
|
||||||
null
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -56,9 +56,14 @@ class ZoroProvider : MainAPI() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Element.toSearchResult(): SearchResponse? {
|
private fun Element.toSearchResult(): SearchResponse? {
|
||||||
val href = fixUrl(this.select("a").attr("href"))
|
val href = fixUrl(this.select("a").attr("href"))
|
||||||
val title = this.select("h3.film-name").text()
|
val title = this.select("h3.film-name").text()
|
||||||
|
/*val episodes = this.select("div.fd-infor > span.fdi-item")?.get(1)?.text()?.let { eps ->
|
||||||
|
// current episode / max episode
|
||||||
|
val epRegex = Regex("Ep (\\d+)/")//Regex("Ep (\\d+)/(\\d+)")
|
||||||
|
epRegex.find(eps)?.groupValues?.get(1)?.toIntOrNull()
|
||||||
|
}*/
|
||||||
if (href.contains("/news/") || title.trim().equals("News", ignoreCase = true)) return null
|
if (href.contains("/news/") || title.trim().equals("News", ignoreCase = true)) return null
|
||||||
val posterUrl = fixUrl(this.select("img").attr("data-src"))
|
val posterUrl = fixUrl(this.select("img").attr("data-src"))
|
||||||
val type = getType(this.select("div.fd-infor > span.fdi-item").text())
|
val type = getType(this.select("div.fd-infor > span.fdi-item").text())
|
||||||
|
@ -71,9 +76,6 @@ class ZoroProvider : MainAPI() {
|
||||||
posterUrl,
|
posterUrl,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
EnumSet.of(DubStatus.Subbed),
|
|
||||||
null,
|
|
||||||
null
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +144,25 @@ class ZoroProvider : MainAPI() {
|
||||||
|
|
||||||
return document.select(".flw-item").map {
|
return document.select(".flw-item").map {
|
||||||
val title = it.selectFirst(".film-detail > .film-name > a")?.attr("title").toString()
|
val title = it.selectFirst(".film-detail > .film-name > a")?.attr("title").toString()
|
||||||
val poster = it.selectFirst(".film-poster > img")?.attr("data-src")
|
val filmPoster = it.selectFirst(".film-poster")
|
||||||
|
val poster = filmPoster.selectFirst("img")?.attr("data-src")
|
||||||
|
|
||||||
|
val episodes = filmPoster.selectFirst("div.rtl > div.tick-eps")?.text()?.let { eps ->
|
||||||
|
// current episode / max episode
|
||||||
|
val epRegex = Regex("Ep (\\d+)/")//Regex("Ep (\\d+)/(\\d+)")
|
||||||
|
epRegex.find(eps)?.groupValues?.get(1)?.toIntOrNull()
|
||||||
|
}
|
||||||
|
val dubsub = filmPoster.selectFirst("div.ltr")?.text()
|
||||||
|
val dubExist = dubsub?.contains("DUB") ?: false
|
||||||
|
val subExist = dubsub?.contains("SUB") ?: false || dubsub?.contains("RAW") ?: false
|
||||||
|
|
||||||
|
val set = if (dubExist && subExist) {
|
||||||
|
EnumSet.of(DubStatus.Dubbed, DubStatus.Subbed)
|
||||||
|
} else if (dubExist) {
|
||||||
|
EnumSet.of(DubStatus.Dubbed)
|
||||||
|
} else {
|
||||||
|
EnumSet.of(DubStatus.Subbed)
|
||||||
|
}
|
||||||
|
|
||||||
val tvType = getType(it.selectFirst(".film-detail > .fd-infor > .fdi-item")?.text().toString())
|
val tvType = getType(it.selectFirst(".film-detail > .fd-infor > .fdi-item")?.text().toString())
|
||||||
val href = fixUrl(it.selectFirst(".film-name a").attr("href"))
|
val href = fixUrl(it.selectFirst(".film-name a").attr("href"))
|
||||||
|
@ -154,15 +174,15 @@ class ZoroProvider : MainAPI() {
|
||||||
tvType,
|
tvType,
|
||||||
poster,
|
poster,
|
||||||
null,
|
null,
|
||||||
|
set,
|
||||||
null,
|
null,
|
||||||
EnumSet.of(DubStatus.Subbed),
|
if (dubExist) episodes else null,
|
||||||
null,
|
if (subExist) episodes else null,
|
||||||
null
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun load(url: String): LoadResponse? {
|
override fun load(url: String): LoadResponse {
|
||||||
val html = get(url).text
|
val html = get(url).text
|
||||||
val document = Jsoup.parse(html)
|
val document = Jsoup.parse(html)
|
||||||
|
|
||||||
|
@ -174,7 +194,6 @@ class ZoroProvider : MainAPI() {
|
||||||
var japaneseTitle: String? = null
|
var japaneseTitle: String? = null
|
||||||
var status: ShowStatus? = null
|
var status: ShowStatus? = null
|
||||||
|
|
||||||
|
|
||||||
for (info in document.select(".anisc-info > .item.item-title")) {
|
for (info in document.select(".anisc-info > .item.item-title")) {
|
||||||
val text = info?.text().toString()
|
val text = info?.text().toString()
|
||||||
when {
|
when {
|
||||||
|
|
|
@ -36,7 +36,6 @@ import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.getGridIsCompact
|
import com.lagradost.cloudstream3.utils.UIHelper.getGridIsCompact
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard
|
import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard
|
||||||
import kotlinx.android.synthetic.main.fragment_search.*
|
import kotlinx.android.synthetic.main.fragment_search.*
|
||||||
import java.lang.Exception
|
|
||||||
import java.util.concurrent.locks.ReentrantLock
|
import java.util.concurrent.locks.ReentrantLock
|
||||||
|
|
||||||
class SearchFragment : Fragment() {
|
class SearchFragment : Fragment() {
|
||||||
|
@ -44,7 +43,7 @@ class SearchFragment : Fragment() {
|
||||||
fun List<SearchResponse>.filterSearchResponse(): List<SearchResponse> {
|
fun List<SearchResponse>.filterSearchResponse(): List<SearchResponse> {
|
||||||
return this.filter { response ->
|
return this.filter { response ->
|
||||||
if (response is AnimeSearchResponse) {
|
if (response is AnimeSearchResponse) {
|
||||||
response.dubStatus?.any { APIRepository.dubStatusActive.contains(it) } ?: false
|
(response.dubStatus.isNullOrEmpty()) || (response.dubStatus.any { APIRepository.dubStatusActive.contains(it) })
|
||||||
} else {
|
} else {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,7 @@ import android.widget.ImageView
|
||||||
import android.widget.ProgressBar
|
import android.widget.ProgressBar
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.cardview.widget.CardView
|
import androidx.cardview.widget.CardView
|
||||||
import com.lagradost.cloudstream3.AnimeSearchResponse
|
import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.DubStatus
|
|
||||||
import com.lagradost.cloudstream3.SearchResponse
|
|
||||||
import com.lagradost.cloudstream3.isMovieType
|
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.getNameFull
|
import com.lagradost.cloudstream3.utils.AppUtils.getNameFull
|
||||||
import com.lagradost.cloudstream3.utils.DataStoreHelper
|
import com.lagradost.cloudstream3.utils.DataStoreHelper
|
||||||
import com.lagradost.cloudstream3.utils.DataStoreHelper.fixVisual
|
import com.lagradost.cloudstream3.utils.DataStoreHelper.fixVisual
|
||||||
|
@ -24,8 +21,9 @@ object SearchResultBuilder {
|
||||||
val cardView: ImageView = itemView.imageView
|
val cardView: ImageView = itemView.imageView
|
||||||
val cardText: TextView = itemView.imageText
|
val cardText: TextView = itemView.imageText
|
||||||
|
|
||||||
val textIsDub: View? = itemView.text_is_dub
|
val textIsDub: TextView? = itemView.text_is_dub
|
||||||
val textIsSub: View? = itemView.text_is_sub
|
val textIsSub: TextView? = itemView.text_is_sub
|
||||||
|
println(card.name)
|
||||||
|
|
||||||
val bg: CardView = itemView.backgroundCard
|
val bg: CardView = itemView.backgroundCard
|
||||||
|
|
||||||
|
@ -45,7 +43,13 @@ object SearchResultBuilder {
|
||||||
cardView.setImage(card.posterUrl)
|
cardView.setImage(card.posterUrl)
|
||||||
|
|
||||||
bg.setOnClickListener {
|
bg.setOnClickListener {
|
||||||
clickCallback.invoke(SearchClickCallback(if(card is DataStoreHelper.ResumeWatchingResult) SEARCH_ACTION_PLAY_FILE else SEARCH_ACTION_LOAD, it, card))
|
clickCallback.invoke(
|
||||||
|
SearchClickCallback(
|
||||||
|
if (card is DataStoreHelper.ResumeWatchingResult) SEARCH_ACTION_PLAY_FILE else SEARCH_ACTION_LOAD,
|
||||||
|
it,
|
||||||
|
card
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
bg.setOnLongClickListener {
|
bg.setOnLongClickListener {
|
||||||
|
@ -69,16 +73,32 @@ object SearchResultBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is AnimeSearchResponse -> {
|
is AnimeSearchResponse -> {
|
||||||
if (card.dubStatus?.size == 1) {
|
if (card.dubStatus != null && card.dubStatus.size > 0) {
|
||||||
//search_result_lang?.visibility = View.VISIBLE
|
|
||||||
if (card.dubStatus.contains(DubStatus.Dubbed)) {
|
if (card.dubStatus.contains(DubStatus.Dubbed)) {
|
||||||
textIsDub?.visibility = View.VISIBLE
|
textIsDub?.visibility = View.VISIBLE
|
||||||
//search_result_lang?.setColorFilter(ContextCompat.getColor(activity, R.color.dubColor))
|
}
|
||||||
} else if (card.dubStatus.contains(DubStatus.Subbed)) {
|
if (card.dubStatus.contains(DubStatus.Subbed)) {
|
||||||
//search_result_lang?.setColorFilter(ContextCompat.getColor(activity, R.color.subColor))
|
|
||||||
textIsSub?.visibility = View.VISIBLE
|
textIsSub?.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
textIsDub?.apply {
|
||||||
|
val dubText = context.getString(R.string.app_dubbed_text)
|
||||||
|
text = if (card.dubEpisodes != null && card.dubEpisodes > 0) {
|
||||||
|
context.getString(R.string.app_dub_sub_episode_text_format).format(dubText, card.dubEpisodes)
|
||||||
|
} else {
|
||||||
|
dubText
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
textIsSub?.apply {
|
||||||
|
val subText = context.getString(R.string.app_subbed_text)
|
||||||
|
text = if (card.subEpisodes != null && card.subEpisodes > 0) {
|
||||||
|
context.getString(R.string.app_dub_sub_episode_text_format).format(subText, card.subEpisodes)
|
||||||
|
} else {
|
||||||
|
subText
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,6 @@
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:background="@drawable/sub_bg_color"
|
android:background="@drawable/sub_bg_color"
|
||||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||||
>
|
/>
|
||||||
</TextView>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
|
@ -55,23 +55,6 @@
|
||||||
android:paddingEnd="5dp"
|
android:paddingEnd="5dp"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
/>
|
/>
|
||||||
<TextView
|
|
||||||
android:id="@+id/text_type"
|
|
||||||
|
|
||||||
tools:text="Movie"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:textColor="@color/textColor"
|
|
||||||
android:paddingRight="10dp"
|
|
||||||
android:paddingLeft="10dp"
|
|
||||||
android:paddingTop="4dp"
|
|
||||||
android:layout_marginBottom="5dp"
|
|
||||||
android:layout_gravity="start"
|
|
||||||
android:paddingBottom="8dp"
|
|
||||||
android:minWidth="50dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:background="@drawable/type_bg_color"
|
|
||||||
android:layout_width="wrap_content" android:layout_height="wrap_content">
|
|
||||||
</TextView>
|
|
||||||
<!--<View
|
<!--<View
|
||||||
android:id="@+id/search_result_lang"
|
android:id="@+id/search_result_lang"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
|
@ -95,6 +78,22 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<!-- <TextView
|
||||||
|
android:text="Movie"
|
||||||
|
android:textColor="@color/textColor"
|
||||||
|
android:paddingRight="10dp"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:paddingTop="4dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
|
android:minWidth="50dp"
|
||||||
|
android:gravity="end"
|
||||||
|
android:background="@drawable/type_bg_color"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
</TextView>-->
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<ImageView android:id="@+id/text_is_dub" android:tint="?attr/colorPrimary"
|
<ImageView android:id="@+id/text_is_dub" android:tint="?attr/colorPrimary"
|
||||||
android:src="@drawable/ic_baseline_subtitles_24" android:layout_width="wrap_content"
|
android:src="@drawable/ic_baseline_subtitles_24" android:layout_width="wrap_content"
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
<color name="dubColorBg">#803B65F5</color>
|
<color name="dubColorBg">#803B65F5</color>
|
||||||
<color name="subColor">#F54A3B</color> <!--F53B66 FA3D79-->
|
<color name="subColor">#F54A3B</color> <!--F53B66 FA3D79-->
|
||||||
<color name="subColorBg">#80F53B66</color>
|
<color name="subColorBg">#80F53B66</color>
|
||||||
<color name="typeColor">#F54A3B</color>
|
<color name="typeColor">#3BF585</color>
|
||||||
<color name="typeColorBg">#4DF54A3B</color>
|
<color name="typeColorBg">#803BF585</color>
|
||||||
|
|
||||||
<color name="video_ripple">#73FFFFFF</color>
|
<color name="video_ripple">#73FFFFFF</color>
|
||||||
<color name="black_overlay">#66000000</color>
|
<color name="black_overlay">#66000000</color>
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
<string name="rew_text_format" translatable="false" formatted="true">-%d</string>
|
<string name="rew_text_format" translatable="false" formatted="true">-%d</string>
|
||||||
<string name="ffw_text_regular_format" translatable="false" formatted="true">%d</string>
|
<string name="ffw_text_regular_format" translatable="false" formatted="true">%d</string>
|
||||||
<string name="rew_text_regular_format" translatable="false" formatted="true">%d</string>
|
<string name="rew_text_regular_format" translatable="false" formatted="true">%d</string>
|
||||||
|
<string name="app_dub_sub_episode_text_format">%s Ep %d</string>
|
||||||
|
|
||||||
<!-- IS NOT NEEDED TO TRANSLATE AS THEY ARE ONLY USED FOR SCREEN READERS AND WONT SHOW UP TO NORMAL USERS -->
|
<!-- IS NOT NEEDED TO TRANSLATE AS THEY ARE ONLY USED FOR SCREEN READERS AND WONT SHOW UP TO NORMAL USERS -->
|
||||||
<string name="result_poster_img_des">Poster</string>
|
<string name="result_poster_img_des">Poster</string>
|
||||||
|
|
Loading…
Reference in a new issue