mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
New TV UI bug fixes
This commit is contained in:
parent
81df68e137
commit
b51aae6bc8
2 changed files with 34 additions and 32 deletions
|
@ -247,6 +247,7 @@ class ResultFragmentTv : Fragment() {
|
|||
)
|
||||
// ===== ===== =====
|
||||
var comingSoon = false
|
||||
var resumeMode = false
|
||||
|
||||
binding?.apply {
|
||||
//episodesShadow.rotationX = 180.0f//if(episodesShadow.isRtl()) 180.0f else 0.0f
|
||||
|
@ -308,9 +309,10 @@ class ResultFragmentTv : Fragment() {
|
|||
resultEpisodesShowButton to resultEpisodesShowText
|
||||
).forEach { (button , text) ->
|
||||
|
||||
button.setOnFocusChangeListener { _, hasFocus ->
|
||||
button.setOnFocusChangeListener { view, hasFocus ->
|
||||
if (!hasFocus) {
|
||||
text.isSelected = false
|
||||
if (view.id == R.id.result_episodes_show_button) toggleEpisodes(false)
|
||||
return@setOnFocusChangeListener
|
||||
}
|
||||
|
||||
|
@ -376,10 +378,6 @@ class ResultFragmentTv : Fragment() {
|
|||
|
||||
resultMetaSite.isFocusable = false
|
||||
|
||||
//resultReloadConnectionOpenInBrowser.setOnClickListener {view ->
|
||||
// view.context?.openBrowser(storedData?.url ?: return@setOnClickListener, fallbackWebview = true)
|
||||
//}
|
||||
|
||||
resultSeasonSelection.setAdapter()
|
||||
resultRangeSelection.setAdapter()
|
||||
resultDubSelection.setAdapter()
|
||||
|
@ -457,11 +455,11 @@ class ResultFragmentTv : Fragment() {
|
|||
observeNullable(viewModel.resumeWatching) { resume ->
|
||||
binding?.apply {
|
||||
|
||||
// > resultResumeSeries is visible when not null
|
||||
if (resume == null) {
|
||||
resultResumeSeries.isVisible = false
|
||||
resumeMode = false
|
||||
return@observeNullable
|
||||
}
|
||||
resumeMode = true
|
||||
|
||||
// show progress no matter if series or movie
|
||||
resume.progress?.let { progress ->
|
||||
|
@ -471,14 +469,16 @@ class ResultFragmentTv : Fragment() {
|
|||
this.max = progress.maxProgress
|
||||
this.progress = progress.progress
|
||||
}
|
||||
resultResumeProgressHolder.isVisible = true
|
||||
} ?: run {
|
||||
resultResumeProgressHolder.isVisible = false
|
||||
}
|
||||
|
||||
resultResumeProgressHolder.isVisible = true
|
||||
resultResumeSeries.isVisible = true
|
||||
resultPlayMovie.isVisible = false
|
||||
resultPlaySeries.isVisible = false
|
||||
resultResumeSeries.isVisible = true
|
||||
} ?: run {
|
||||
//resumeMode = false
|
||||
resultResumeProgressHolder.isVisible = false
|
||||
resultResumeProgressHolder.isVisible = false
|
||||
}
|
||||
|
||||
focusPlayButton()
|
||||
// Stops last button right focus if it is a movie
|
||||
|
@ -490,7 +490,7 @@ class ResultFragmentTv : Fragment() {
|
|||
resume.isMovie -> context?.getString(R.string.resume)
|
||||
resume.result.season != null ->
|
||||
"${getString(R.string.season_short)}${resume.result.season}:${getString(R.string.episode_short)}${resume.result.episode}"
|
||||
else -> "${getString(R.string.episode)}${resume.result.episode}"
|
||||
else -> "${getString(R.string.episode)} ${resume.result.episode}"
|
||||
}
|
||||
|
||||
resultResumeSeriesButton.setOnClickListener {
|
||||
|
@ -646,15 +646,14 @@ class ResultFragmentTv : Fragment() {
|
|||
}
|
||||
|
||||
observeNullable(viewModel.movie) { data ->
|
||||
if (data == null) return@observeNullable
|
||||
if (data == null || resumeMode) {
|
||||
return@observeNullable
|
||||
}
|
||||
|
||||
binding?.apply {
|
||||
resultPlayMovie.isVisible = (data is Resource.Success) && !comingSoon
|
||||
resultPlaySeries.isVisible = false
|
||||
resultEpisodesShow.isVisible = false
|
||||
|
||||
(data as? Resource.Success)?.value?.let { (text, ep) ->
|
||||
//resultPlayMovieText.setText(text)
|
||||
|
||||
resultPlayMovieButton.setOnClickListener {
|
||||
viewModel.handleAction(
|
||||
EpisodeClickEvent(ACTION_CLICK_DEFAULT, ep)
|
||||
|
@ -666,14 +665,17 @@ class ResultFragmentTv : Fragment() {
|
|||
)
|
||||
return@setOnLongClickListener true
|
||||
}
|
||||
//focusPlayButton()
|
||||
|
||||
resultPlayMovie.isVisible = !comingSoon
|
||||
if (comingSoon)
|
||||
resultBookmarkButton.requestFocus()
|
||||
else
|
||||
resultPlayMovieButton.requestFocus()
|
||||
|
||||
// Stops last button right focus
|
||||
resultSearchButton.nextFocusRightId = R.id.result_search_Button
|
||||
}
|
||||
}
|
||||
//focusPlayButton()
|
||||
}
|
||||
|
||||
observeNullable(viewModel.selectPopup) { popup ->
|
||||
|
@ -774,16 +776,14 @@ class ResultFragmentTv : Fragment() {
|
|||
|
||||
binding?.apply {
|
||||
|
||||
resultPlayMovie.isVisible = false
|
||||
resultPlaySeries.isVisible = true && !comingSoon
|
||||
resultEpisodes.isVisible = true && !comingSoon
|
||||
resultEpisodesShow.isVisible = true && !comingSoon
|
||||
if (comingSoon)
|
||||
resultBookmarkButton.requestFocus()
|
||||
|
||||
// resultEpisodeLoading.isVisible = episodes is Resource.Loading
|
||||
if (episodes is Resource.Success) {
|
||||
val first = episodes.value.firstOrNull()
|
||||
if (first != null) {
|
||||
resultPlaySeriesText.text = //"${getString(R.string.season_short)}${first.season}:${getString(R.string.episode_short)}${first.episode}"
|
||||
resultPlaySeriesText.text =
|
||||
when {
|
||||
first.season != null ->
|
||||
"${getString(R.string.season_short)}${first.season}:${getString(R.string.episode_short)}${first.episode}"
|
||||
|
@ -805,8 +805,9 @@ class ResultFragmentTv : Fragment() {
|
|||
}
|
||||
if (!hasLoadedEpisodesOnce) {
|
||||
hasLoadedEpisodesOnce = true
|
||||
focusPlayButton()
|
||||
resultPlaySeries.requestFocus()
|
||||
resultPlaySeries.isVisible = !resumeMode && !comingSoon
|
||||
resultEpisodesShow.isVisible = true && !comingSoon
|
||||
resultPlaySeriesButton.requestFocus()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -904,9 +905,6 @@ class ResultFragmentTv : Fragment() {
|
|||
)
|
||||
comingSoon = d.comingSoon
|
||||
resultTvComingSoon.isVisible = d.comingSoon
|
||||
resultPlayMovie.isGone = d.comingSoon
|
||||
resultPlaySeries.isGone = d.comingSoon
|
||||
resultDataHolder.isGone = d.comingSoon
|
||||
|
||||
UIHelper.populateChips(resultTag, d.tags)
|
||||
resultCastItems.isGone = d.actors.isNullOrEmpty()
|
||||
|
|
|
@ -271,7 +271,9 @@ https://developer.android.com/design/ui/tv/samples/jet-fit
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:id="@+id/result_play_movie"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/result_play_movie_button"
|
||||
|
@ -323,7 +325,9 @@ https://developer.android.com/design/ui/tv/samples/jet-fit
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/result_resume_series_button"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue