fixed tv autoselect

This commit is contained in:
LagradOst 2022-03-29 23:50:07 +02:00
parent 8576d9c640
commit 6b3eb0047f
5 changed files with 567 additions and 558 deletions

View file

@ -608,10 +608,11 @@ class GeneratorPlayer : FullScreenPlayer() {
observe(viewModel.currentLinks) { observe(viewModel.currentLinks) {
currentLinks = it currentLinks = it
val turnVisible = it.isNotEmpty() val turnVisible = it.isNotEmpty()
if (turnVisible && overlay_loading_skip_button?.isGone == true) { val wasGone = overlay_loading_skip_button?.isGone == true
overlay_loading_skip_button?.isVisible = turnVisible
if (turnVisible && wasGone) {
overlay_loading_skip_button?.requestFocus() overlay_loading_skip_button?.requestFocus()
} }
overlay_loading_skip_button?.isVisible = turnVisible
} }
observe(viewModel.currentSubs) { set -> observe(viewModel.currentSubs) { set ->

View file

@ -60,6 +60,7 @@ import com.lagradost.cloudstream3.ui.player.SubtitleData
import com.lagradost.cloudstream3.ui.quicksearch.QuickSearchFragment import com.lagradost.cloudstream3.ui.quicksearch.QuickSearchFragment
import com.lagradost.cloudstream3.ui.search.SearchAdapter import com.lagradost.cloudstream3.ui.search.SearchAdapter
import com.lagradost.cloudstream3.ui.search.SearchHelper import com.lagradost.cloudstream3.ui.search.SearchHelper
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTrueTvSettings
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings
import com.lagradost.cloudstream3.ui.subtitles.SubtitlesFragment.Companion.getDownloadSubsLanguageISO639_1 import com.lagradost.cloudstream3.ui.subtitles.SubtitlesFragment.Companion.getDownloadSubsLanguageISO639_1
import com.lagradost.cloudstream3.utils.* import com.lagradost.cloudstream3.utils.*
@ -429,9 +430,19 @@ class ResultFragment : Fragment(), PanelsChildGestureRegionObserver.GestureRegio
2 -> { 2 -> {
result_bookmark_fab?.isGone = result_bookmark_fab?.context?.isTvSettings() == true result_bookmark_fab?.isGone = result_bookmark_fab?.context?.isTvSettings() == true
result_bookmark_fab?.extend() result_bookmark_fab?.extend()
if (result_bookmark_button?.context?.isTvSettings() == true) { if (result_bookmark_button?.context?.isTrueTvSettings() == true) {
when {
result_play_movie?.isVisible == true -> {
result_play_movie?.requestFocus()
}
result_resume_series_button?.isVisible == true -> {
result_resume_series_button?.requestFocus()
}
else -> {
result_bookmark_button?.requestFocus() result_bookmark_button?.requestFocus()
} }
}
}
result_loading?.isVisible = false result_loading?.isVisible = false
result_finish_loading?.isVisible = true result_finish_loading?.isVisible = true

View file

@ -72,7 +72,11 @@ class SettingsFragment : PreferenceFragmentCompat() {
} }
fun Context.isTrueTvSettings(): Boolean { fun Context.isTrueTvSettings(): Boolean {
return getLayoutInt() == 1 var value = getLayoutInt()
if (value == -1) {
value = if (isAutoTv()) 1 else 0
}
return value == 1
} }
fun Context.isEmulatorSettings(): Boolean { fun Context.isEmulatorSettings(): Boolean {

View file

@ -1,18 +1,16 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal" android:orientation="horizontal"
android:keepScreenOn="true" android:keepScreenOn="true"
android:id="@+id/player_background" android:id="@+id/player_background"
app:backgroundTint="@android:color/black" app:backgroundTint="@android:color/black"
android:background="@android:color/black" android:background="@android:color/black"
android:screenOrientation="sensorLandscape" android:screenOrientation="sensorLandscape"
app:surface_type="texture_view" app:surface_type="texture_view">
>
<!-- <!--
app:fastforward_increment="10000" app:fastforward_increment="10000"
app:rewind_increment="10000"--> app:rewind_increment="10000"-->
@ -28,8 +26,7 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:controller_layout_id="@layout/player_custom_layout_tv" app:controller_layout_id="@layout/player_custom_layout_tv" />
/>
<FrameLayout <FrameLayout
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
@ -40,13 +37,11 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/player_loading_overlay" android:id="@+id/player_loading_overlay"
android:background="@android:color/black" android:background="@android:color/black"
android:backgroundTint="@android:color/black" android:backgroundTint="@android:color/black">
>
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:nextFocusUp="@id/player_loading_go_back" android:nextFocusUp="@id/player_loading_go_back"
android:nextFocusLeft="@id/player_loading_go_back" android:nextFocusLeft="@id/player_loading_go_back"
android:focusableInTouchMode="true"
tools:visibility="visible" tools:visibility="visible"
android:visibility="gone" android:visibility="gone"
@ -54,19 +49,19 @@
android:layout_gravity="center" android:layout_gravity="center"
android:id="@+id/overlay_loading_skip_button" android:id="@+id/overlay_loading_skip_button"
android:text="@string/skip_loading" android:text="@string/skip_loading"
android:focusable="true"
android:clickable="true"
android:focusableInTouchMode="true"
app:icon="@drawable/ic_baseline_skip_next_24" app:icon="@drawable/ic_baseline_skip_next_24"
style="@style/VideoButtonTV" style="@style/VideoButtonTV"
android:layout_width="wrap_content"> android:layout_width="wrap_content" />
</com.google.android.material.button.MaterialButton>
<ProgressBar <ProgressBar
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="50dp" android:layout_height="50dp"
android:layout_gravity="center" android:layout_gravity="center"
android:id="@+id/main_load" android:id="@+id/main_load" />
>
</ProgressBar>
<FrameLayout <FrameLayout
android:id="@+id/video_go_back_holder_holder" android:id="@+id/video_go_back_holder_holder"
@ -74,16 +69,15 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content">
>
<ImageView <ImageView
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_gravity="center" android:layout_gravity="center"
android:src="@drawable/ic_baseline_arrow_back_24" android:src="@drawable/ic_baseline_arrow_back_24"
app:tint="@android:color/white" app:tint="@android:color/white" />
>
</ImageView>
<ImageView <ImageView
android:nextFocusRight="@id/overlay_loading_skip_button" android:nextFocusRight="@id/overlay_loading_skip_button"
android:nextFocusDown="@id/overlay_loading_skip_button" android:nextFocusDown="@id/overlay_loading_skip_button"
@ -95,10 +89,10 @@
android:layout_gravity="center" android:layout_gravity="center"
android:focusable="true" android:focusable="true"
android:clickable="true" android:clickable="true"
android:background="@drawable/video_tap_button_always_white"> android:background="@drawable/video_tap_button_always_white" />
</ImageView>
</FrameLayout> </FrameLayout>
</FrameLayout> </FrameLayout>
<FrameLayout <FrameLayout
android:visibility="gone" android:visibility="gone"
android:paddingStart="20dp" android:paddingStart="20dp"
@ -121,9 +115,8 @@
android:textStyle="bold" android:textStyle="bold"
android:textColor="@color/white" android:textColor="@color/white"
android:id="@+id/video_torrent_progress" android:id="@+id/video_torrent_progress"
tools:text="78% at 18kb/s" tools:text="78% at 18kb/s" />
>
</TextView>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -133,7 +126,6 @@
android:textColor="@color/white" android:textColor="@color/white"
android:id="@+id/video_torrent_seeders" android:id="@+id/video_torrent_seeders"
tools:text="17 seeders" tools:text="17 seeders"
app:layout_constraintTop_toBottomOf="@+id/player_video_title"> app:layout_constraintTop_toBottomOf="@+id/player_video_title" />
</TextView>
</FrameLayout> </FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -396,10 +396,7 @@
app:cornerRadius="4dp" app:cornerRadius="4dp"
app:icon="@drawable/ic_baseline_bookmark_24" app:icon="@drawable/ic_baseline_bookmark_24"
tools:text="Bookmark" tools:text="Bookmark"
tools:visibility="gone"> tools:visibility="visible" />
<requestFocus />
</com.google.android.material.button.MaterialButton>
<TextView <TextView
android:id="@+id/result_cast_text" android:id="@+id/result_cast_text"
@ -514,7 +511,11 @@
android:nextFocusDown="@id/result_download_movie" android:nextFocusDown="@id/result_download_movie"
android:text="@string/play_movie_button" android:text="@string/play_movie_button"
android:visibility="visible" android:visibility="visible"
app:icon="@drawable/ic_baseline_play_arrow_24" /> app:icon="@drawable/ic_baseline_play_arrow_24">
<requestFocus />
</com.google.android.material.button.MaterialButton>
<!--<com.google.android.material.button.MaterialButton <!--<com.google.android.material.button.MaterialButton