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) {
currentLinks = it
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?.isVisible = turnVisible
}
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.search.SearchAdapter
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.subtitles.SubtitlesFragment.Companion.getDownloadSubsLanguageISO639_1
import com.lagradost.cloudstream3.utils.*
@ -429,8 +430,18 @@ class ResultFragment : Fragment(), PanelsChildGestureRegionObserver.GestureRegio
2 -> {
result_bookmark_fab?.isGone = result_bookmark_fab?.context?.isTvSettings() == true
result_bookmark_fab?.extend()
if (result_bookmark_button?.context?.isTvSettings() == true) {
result_bookmark_button?.requestFocus()
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_loading?.isVisible = false

View file

@ -72,7 +72,11 @@ class SettingsFragment : PreferenceFragmentCompat() {
}
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 {

View file

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

File diff suppressed because it is too large Load diff