mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
New TV UI bug fixes (#983)
This commit is contained in:
parent
4817b29b9c
commit
638cc4fee9
2 changed files with 28 additions and 32 deletions
|
@ -309,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
|
||||
}
|
||||
|
||||
|
@ -377,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()
|
||||
|
@ -458,11 +455,12 @@ class ResultFragmentTv : Fragment() {
|
|||
observeNullable(viewModel.resumeWatching) { resume ->
|
||||
binding?.apply {
|
||||
|
||||
// > resultResumeSeries is visible when not null
|
||||
if (resume == null) {
|
||||
resultResumeSeries.isVisible = false
|
||||
return@observeNullable
|
||||
}
|
||||
resultResumeSeries.isVisible = true
|
||||
resultPlayMovie.isVisible = false
|
||||
resultPlaySeries.isVisible = false
|
||||
|
||||
// show progress no matter if series or movie
|
||||
resume.progress?.let { progress ->
|
||||
|
@ -477,10 +475,6 @@ class ResultFragmentTv : Fragment() {
|
|||
resultResumeProgressHolder.isVisible = false
|
||||
}
|
||||
|
||||
resultPlayMovie.isVisible = false
|
||||
resultPlaySeries.isVisible = false
|
||||
resultResumeSeries.isVisible = true
|
||||
|
||||
focusPlayButton()
|
||||
// Stops last button right focus if it is a movie
|
||||
if (resume.isMovie)
|
||||
|
@ -647,15 +641,14 @@ class ResultFragmentTv : Fragment() {
|
|||
}
|
||||
|
||||
observeNullable(viewModel.movie) { data ->
|
||||
if (data == null) return@observeNullable
|
||||
if (data == null ) {
|
||||
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)
|
||||
|
@ -667,14 +660,17 @@ class ResultFragmentTv : Fragment() {
|
|||
)
|
||||
return@setOnLongClickListener true
|
||||
}
|
||||
//focusPlayButton()
|
||||
|
||||
resultPlayMovie.isVisible = !comingSoon && resultResumeSeries.isGone
|
||||
if (comingSoon)
|
||||
resultBookmarkButton.requestFocus()
|
||||
else
|
||||
resultPlayMovieButton.requestFocus()
|
||||
|
||||
// Stops last button right focus
|
||||
resultSearchButton.nextFocusRightId = R.id.result_search_Button
|
||||
}
|
||||
}
|
||||
//focusPlayButton()
|
||||
}
|
||||
|
||||
observeNullable(viewModel.selectPopup) { popup ->
|
||||
|
@ -778,16 +774,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}"
|
||||
|
@ -809,8 +803,9 @@ class ResultFragmentTv : Fragment() {
|
|||
}
|
||||
if (!hasLoadedEpisodesOnce) {
|
||||
hasLoadedEpisodesOnce = true
|
||||
focusPlayButton()
|
||||
resultPlaySeries.requestFocus()
|
||||
resultPlaySeries.isVisible = resultResumeSeries.isGone && !comingSoon
|
||||
resultEpisodesShow.isVisible = true && !comingSoon
|
||||
resultPlaySeriesButton.requestFocus()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -919,9 +914,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…
Reference in a new issue