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
|
||||
|
||||
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")
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
@ -690,6 +702,8 @@ class ResultFragment : Fragment() {
|
|||
}
|
||||
|
||||
observe(viewModel.episodes) { episodeList ->
|
||||
lateFixDownloadButton( episodeList.size <= 1) // movies can have multible parts but still be *movies* this will fix this
|
||||
|
||||
when (startAction) {
|
||||
START_ACTION_RESUME_LATEST -> {
|
||||
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
|
||||
result_movie_parent.visibility = VISIBLE
|
||||
result_episodes_text.visibility = GONE
|
||||
result_episodes.visibility = GONE
|
||||
lateFixDownloadButton(true)
|
||||
|
||||
result_play_movie.setOnClickListener {
|
||||
val card = currentEpisodes?.first() ?: return@setOnClickListener
|
||||
|
@ -933,34 +945,34 @@ class ResultFragment : Fragment() {
|
|||
)
|
||||
) { downloadClickEvent ->
|
||||
if (downloadClickEvent.action == DOWNLOAD_ACTION_DOWNLOAD) {
|
||||
handleAction(
|
||||
EpisodeClickEvent(
|
||||
ACTION_DOWNLOAD_EPISODE,
|
||||
ResultEpisode(
|
||||
d.name,
|
||||
null,
|
||||
0,
|
||||
null,
|
||||
d.dataUrl,
|
||||
d.apiName,
|
||||
localId,
|
||||
0,
|
||||
0L,
|
||||
0L,
|
||||
null,
|
||||
null
|
||||
currentEpisodes?.first()?.let { episode ->
|
||||
handleAction(
|
||||
EpisodeClickEvent(
|
||||
ACTION_DOWNLOAD_EPISODE,
|
||||
ResultEpisode(
|
||||
d.name,
|
||||
null,
|
||||
0,
|
||||
null,
|
||||
episode.data,
|
||||
d.apiName,
|
||||
localId,
|
||||
0,
|
||||
0L,
|
||||
0L,
|
||||
null,
|
||||
null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
} else {
|
||||
handleDownloadClick(activity, currentHeaderName, downloadClickEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result_movie_parent.visibility = GONE
|
||||
result_episodes_text.visibility = VISIBLE
|
||||
result_episodes.visibility = VISIBLE
|
||||
lateFixDownloadButton(false)
|
||||
}
|
||||
|
||||
when (d) {
|
||||
|
|
|
@ -50,19 +50,22 @@ object AppUtils {
|
|||
* | Episode 2
|
||||
* **/
|
||||
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) {
|
||||
return if(episode != null && season != null) {
|
||||
"S${season}:E${episode} $name"
|
||||
} else if(episode != null) {
|
||||
"Episode $episode. $name"
|
||||
return if(rEpisode != null && rSeason != null) {
|
||||
"S${rSeason}:E${rEpisode} $name"
|
||||
} else if(rEpisode != null) {
|
||||
"Episode $rEpisode. $name"
|
||||
} else {
|
||||
name
|
||||
}
|
||||
} else {
|
||||
if(episode != null && season != null) {
|
||||
return "Season $season - Episode $episode"
|
||||
} else if(season == null) {
|
||||
return "Episode $episode"
|
||||
if(rEpisode != null && rSeason != null) {
|
||||
return "Season $rSeason - Episode $rEpisode"
|
||||
} else if(rSeason == null) {
|
||||
return "Episode $rEpisode"
|
||||
}
|
||||
}
|
||||
return ""
|
||||
|
|
Loading…
Reference in a new issue