mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
fix semi movie
This commit is contained in:
parent
693edef893
commit
5e619c18cc
2 changed files with 47 additions and 32 deletions
|
@ -237,6 +237,18 @@ class ResultFragment : Fragment() {
|
||||||
|
|
||||||
var startAction: Int? = null
|
var startAction: Int? = null
|
||||||
|
|
||||||
|
private fun lateFixDownloadButton(show: Boolean) {
|
||||||
|
if (show) {
|
||||||
|
result_movie_parent.visibility = VISIBLE
|
||||||
|
result_episodes_text.visibility = GONE
|
||||||
|
result_episodes.visibility = GONE
|
||||||
|
} else {
|
||||||
|
result_movie_parent.visibility = GONE
|
||||||
|
result_episodes_text.visibility = VISIBLE
|
||||||
|
result_episodes.visibility = VISIBLE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
@ -690,6 +702,8 @@ class ResultFragment : Fragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
observe(viewModel.episodes) { episodeList ->
|
observe(viewModel.episodes) { episodeList ->
|
||||||
|
lateFixDownloadButton( episodeList.size <= 1) // movies can have multible parts but still be *movies* this will fix this
|
||||||
|
|
||||||
when (startAction) {
|
when (startAction) {
|
||||||
START_ACTION_RESUME_LATEST -> {
|
START_ACTION_RESUME_LATEST -> {
|
||||||
for (ep in episodeList) {
|
for (ep in episodeList) {
|
||||||
|
@ -884,11 +898,9 @@ class ResultFragment : Fragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d.type == TvType.Movie && d is MovieLoadResponse) {
|
if (d.type == TvType.Movie) {
|
||||||
val hasDownloadSupport = api.hasDownloadSupport
|
val hasDownloadSupport = api.hasDownloadSupport
|
||||||
result_movie_parent.visibility = VISIBLE
|
lateFixDownloadButton(true)
|
||||||
result_episodes_text.visibility = GONE
|
|
||||||
result_episodes.visibility = GONE
|
|
||||||
|
|
||||||
result_play_movie.setOnClickListener {
|
result_play_movie.setOnClickListener {
|
||||||
val card = currentEpisodes?.first() ?: return@setOnClickListener
|
val card = currentEpisodes?.first() ?: return@setOnClickListener
|
||||||
|
@ -933,6 +945,7 @@ class ResultFragment : Fragment() {
|
||||||
)
|
)
|
||||||
) { downloadClickEvent ->
|
) { downloadClickEvent ->
|
||||||
if (downloadClickEvent.action == DOWNLOAD_ACTION_DOWNLOAD) {
|
if (downloadClickEvent.action == DOWNLOAD_ACTION_DOWNLOAD) {
|
||||||
|
currentEpisodes?.first()?.let { episode ->
|
||||||
handleAction(
|
handleAction(
|
||||||
EpisodeClickEvent(
|
EpisodeClickEvent(
|
||||||
ACTION_DOWNLOAD_EPISODE,
|
ACTION_DOWNLOAD_EPISODE,
|
||||||
|
@ -941,7 +954,7 @@ class ResultFragment : Fragment() {
|
||||||
null,
|
null,
|
||||||
0,
|
0,
|
||||||
null,
|
null,
|
||||||
d.dataUrl,
|
episode.data,
|
||||||
d.apiName,
|
d.apiName,
|
||||||
localId,
|
localId,
|
||||||
0,
|
0,
|
||||||
|
@ -952,15 +965,14 @@ class ResultFragment : Fragment() {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
handleDownloadClick(activity, currentHeaderName, downloadClickEvent)
|
handleDownloadClick(activity, currentHeaderName, downloadClickEvent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result_movie_parent.visibility = GONE
|
lateFixDownloadButton(false)
|
||||||
result_episodes_text.visibility = VISIBLE
|
|
||||||
result_episodes.visibility = VISIBLE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
when (d) {
|
when (d) {
|
||||||
|
|
|
@ -50,19 +50,22 @@ object AppUtils {
|
||||||
* | Episode 2
|
* | Episode 2
|
||||||
* **/
|
* **/
|
||||||
fun getNameFull(name: String?, episode: Int?, season: Int?): String {
|
fun getNameFull(name: String?, episode: Int?, season: Int?): String {
|
||||||
|
val rEpisode = if(episode == 0) null else episode
|
||||||
|
val rSeason = if(season == 0) null else season
|
||||||
|
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
return if(episode != null && season != null) {
|
return if(rEpisode != null && rSeason != null) {
|
||||||
"S${season}:E${episode} $name"
|
"S${rSeason}:E${rEpisode} $name"
|
||||||
} else if(episode != null) {
|
} else if(rEpisode != null) {
|
||||||
"Episode $episode. $name"
|
"Episode $rEpisode. $name"
|
||||||
} else {
|
} else {
|
||||||
name
|
name
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(episode != null && season != null) {
|
if(rEpisode != null && rSeason != null) {
|
||||||
return "Season $season - Episode $episode"
|
return "Season $rSeason - Episode $rEpisode"
|
||||||
} else if(season == null) {
|
} else if(rSeason == null) {
|
||||||
return "Episode $episode"
|
return "Episode $rEpisode"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
|
|
Loading…
Reference in a new issue