mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Many fixes
This commit is contained in:
parent
45ecc903a2
commit
6e89ed9d81
6 changed files with 184 additions and 120 deletions
|
@ -539,6 +539,10 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
||||||
val isTrueTv = isTrueTvSettings()
|
val isTrueTv = isTrueTvSettings()
|
||||||
navView.menu.findItem(R.id.navigation_library)?.isVisible = !isTrueTv
|
navView.menu.findItem(R.id.navigation_library)?.isVisible = !isTrueTv
|
||||||
navRailView.menu.findItem(R.id.navigation_library)?.isVisible = !isTrueTv
|
navRailView.menu.findItem(R.id.navigation_library)?.isVisible = !isTrueTv
|
||||||
|
|
||||||
|
// Hide downloads on TV
|
||||||
|
navView.menu.findItem(R.id.navigation_downloads)?.isVisible = !isTrueTv
|
||||||
|
navRailView.menu.findItem(R.id.navigation_downloads)?.isVisible = !isTrueTv
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1121,7 +1125,8 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
||||||
val r2 = Rect(x - dx, y - dy, x + dx, y + dy)
|
val r2 = Rect(x - dx, y - dy, x + dx, y + dy)
|
||||||
newFocus.requestRectangleOnScreen(r2, false)
|
newFocus.requestRectangleOnScreen(r2, false)
|
||||||
// TvFocus.current =TvFocus.current.copy(y=y.toFloat())
|
// TvFocus.current =TvFocus.current.copy(y=y.toFloat())
|
||||||
} catch (_ : Throwable) { }
|
} catch (_: Throwable) {
|
||||||
|
}
|
||||||
TvFocus.updateFocusView(newFocus)
|
TvFocus.updateFocusView(newFocus)
|
||||||
/*var focus = newFocus
|
/*var focus = newFocus
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.lagradost.cloudstream3.ui
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import androidx.core.view.children
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
@ -83,12 +84,15 @@ class GrdLayoutManager(val context: Context, _spanCount: Int) :
|
||||||
View.FOCUS_DOWN -> {
|
View.FOCUS_DOWN -> {
|
||||||
return spanCount
|
return spanCount
|
||||||
}
|
}
|
||||||
|
|
||||||
View.FOCUS_UP -> {
|
View.FOCUS_UP -> {
|
||||||
return -spanCount
|
return -spanCount
|
||||||
}
|
}
|
||||||
|
|
||||||
View.FOCUS_RIGHT -> {
|
View.FOCUS_RIGHT -> {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
View.FOCUS_LEFT -> {
|
View.FOCUS_LEFT -> {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
@ -98,12 +102,15 @@ class GrdLayoutManager(val context: Context, _spanCount: Int) :
|
||||||
View.FOCUS_DOWN -> {
|
View.FOCUS_DOWN -> {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
View.FOCUS_UP -> {
|
View.FOCUS_UP -> {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
View.FOCUS_RIGHT -> {
|
View.FOCUS_RIGHT -> {
|
||||||
return spanCount
|
return spanCount
|
||||||
}
|
}
|
||||||
|
|
||||||
View.FOCUS_LEFT -> {
|
View.FOCUS_LEFT -> {
|
||||||
return -spanCount
|
return -spanCount
|
||||||
}
|
}
|
||||||
|
@ -156,3 +163,31 @@ class AutofitRecyclerView @JvmOverloads constructor(context: Context, attrs: Att
|
||||||
layoutManager = manager
|
layoutManager = manager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recyclerview wherein the max item width or height is set by the biggest view to prevent inconsistent view sizes.
|
||||||
|
*/
|
||||||
|
class MaxRecyclerView(ctx: Context, attrs: AttributeSet) : RecyclerView(ctx, attrs) {
|
||||||
|
private var biggestObserved: Int = 0
|
||||||
|
private val orientation = LayoutManager.getProperties(context, attrs, 0, 0).orientation
|
||||||
|
private val isHorizontal = orientation == HORIZONTAL
|
||||||
|
private fun View.updateMaxSize() {
|
||||||
|
if (isHorizontal) {
|
||||||
|
this.minimumHeight = biggestObserved
|
||||||
|
} else {
|
||||||
|
this.minimumWidth = biggestObserved
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onChildAttachedToWindow(child: View) {
|
||||||
|
child.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED)
|
||||||
|
val observed = if (isHorizontal) child.measuredHeight else child.measuredWidth
|
||||||
|
if (observed > biggestObserved) {
|
||||||
|
biggestObserved = observed
|
||||||
|
children.forEach { it.updateMaxSize() }
|
||||||
|
} else {
|
||||||
|
child.updateMaxSize()
|
||||||
|
}
|
||||||
|
super.onChildAttachedToWindow(child)
|
||||||
|
}
|
||||||
|
}
|
|
@ -177,7 +177,7 @@ class ResultFragmentTv : Fragment() {
|
||||||
isVisible = true
|
isVisible = true
|
||||||
}
|
}
|
||||||
|
|
||||||
this.animate().alpha(if (turnVisible) 1.0f else 0.0f).apply {
|
this.animate().alpha(if (turnVisible) 0.97f else 0.0f).apply {
|
||||||
duration = 200
|
duration = 200
|
||||||
interpolator = DecelerateInterpolator()
|
interpolator = DecelerateInterpolator()
|
||||||
setListener(object : Animator.AnimatorListener {
|
setListener(object : Animator.AnimatorListener {
|
||||||
|
@ -294,9 +294,9 @@ class ResultFragmentTv : Fragment() {
|
||||||
toggleEpisodes(true)
|
toggleEpisodes(true)
|
||||||
binding?.apply {
|
binding?.apply {
|
||||||
val views = listOf(
|
val views = listOf(
|
||||||
|
resultDubSelection,
|
||||||
resultSeasonSelection,
|
resultSeasonSelection,
|
||||||
resultRangeSelection,
|
resultRangeSelection,
|
||||||
resultDubSelection,
|
|
||||||
resultEpisodes,
|
resultEpisodes,
|
||||||
resultPlayTrailer,
|
resultPlayTrailer,
|
||||||
)
|
)
|
||||||
|
|
|
@ -518,7 +518,8 @@ class ResultViewModel2 : ViewModel() {
|
||||||
val episodeNumber = episodes[currentIndex].episode
|
val episodeNumber = episodes[currentIndex].episode
|
||||||
if (episodeNumber < currentMin) {
|
if (episodeNumber < currentMin) {
|
||||||
currentMin = episodeNumber
|
currentMin = episodeNumber
|
||||||
} else if (episodeNumber > currentMax) {
|
}
|
||||||
|
if (episodeNumber > currentMax) {
|
||||||
currentMax = episodeNumber
|
currentMax = episodeNumber
|
||||||
}
|
}
|
||||||
++currentIndex
|
++currentIndex
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<gradient
|
<gradient
|
||||||
android:startColor="@color/transparent"
|
android:centerColor="?attr/primaryBlackBackground"
|
||||||
android:endColor="?attr/primaryBlackBackground"/>
|
android:centerX="0.2"
|
||||||
|
android:endColor="?attr/primaryBlackBackground"
|
||||||
|
android:startColor="@color/transparent" />
|
||||||
</shape>
|
</shape>
|
|
@ -535,38 +535,60 @@ https://developer.android.com/design/ui/tv/samples/jet-fit
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|
||||||
<FrameLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:visibility="gone"
|
|
||||||
tools:visibility="visible"
|
|
||||||
android:id="@+id/episodes_shadow"
|
android:id="@+id/episodes_shadow"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:visibility="visible">
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
These two shadow spaces are used to create a view which always x% bigger
|
||||||
|
than the episode_holder_tv. This is required for creating a consistent shadow.
|
||||||
|
-->
|
||||||
|
<Space
|
||||||
|
android:id="@+id/shadow_space_1"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintDimensionRatio="1:1"
|
||||||
|
app:layout_constraintEnd_toEndOf="@+id/episode_holder_tv"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/episode_holder_tv" />
|
||||||
|
|
||||||
|
<!--
|
||||||
|
The dimension ratio should and episodes_shadow centerX should add up to
|
||||||
|
100% for the best results. For example (100:80 + 0.2) or (100:70 + 0.3).
|
||||||
|
Bigger centerX => Larger fade distance.
|
||||||
|
-->
|
||||||
|
<Space
|
||||||
|
android:id="@+id/shadow_space_2"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintDimensionRatio="100:80"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/shadow_space_1" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
android:focusableInTouchMode="false"
|
android:focusableInTouchMode="false"
|
||||||
android:importantForAccessibility="no"
|
android:importantForAccessibility="no"
|
||||||
android:src="@drawable/episodes_shadow"/>
|
android:src="@drawable/episodes_shadow"
|
||||||
<ImageView
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:layout_width="match_parent"
|
app:layout_constraintStart_toStartOf="@+id/shadow_space_2"
|
||||||
android:layout_height="match_parent"
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
android:layout_gravity="end"
|
|
||||||
android:clickable="false"
|
|
||||||
android:focusable="false"
|
|
||||||
android:focusableInTouchMode="false"
|
|
||||||
android:importantForAccessibility="no"
|
|
||||||
android:src="@drawable/episodes_shadow"/>
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/episode_holder_tv"
|
android:id="@+id/episode_holder_tv"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingStart="@dimen/result_padding"
|
android:paddingStart="@dimen/result_padding"
|
||||||
|
@ -576,51 +598,50 @@ https://developer.android.com/design/ui/tv/samples/jet-fit
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:ignore="RtlHardcoded"
|
tools:ignore="RtlHardcoded"
|
||||||
tools:visibility="gone">
|
tools:visibility="visible">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<com.lagradost.cloudstream3.ui.MaxRecyclerView
|
||||||
|
android:id="@+id/result_dub_selection"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:descendantFocusability="afterDescendants"
|
||||||
|
android:nextFocusLeft="@id/result_episodes_show"
|
||||||
|
android:nextFocusRight="@id/result_season_selection"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingVertical="@dimen/result_padding"
|
||||||
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
|
tools:listitem="@layout/result_selection"
|
||||||
|
tools:visibility="gone" />
|
||||||
|
|
||||||
|
<com.lagradost.cloudstream3.ui.MaxRecyclerView
|
||||||
android:id="@+id/result_season_selection"
|
android:id="@+id/result_season_selection"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
|
|
||||||
android:descendantFocusability="afterDescendants"
|
android:descendantFocusability="afterDescendants"
|
||||||
android:nextFocusLeft="@id/result_episodes_show"
|
android:nextFocusLeft="@id/result_dub_selection"
|
||||||
android:nextFocusRight="@id/result_range_selection"
|
android:nextFocusRight="@id/result_range_selection"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingVertical="@dimen/result_padding"
|
android:paddingVertical="@dimen/result_padding"
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
tools:listitem="@layout/result_selection" />
|
tools:listitem="@layout/result_selection"
|
||||||
|
tools:visibility="gone" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<com.lagradost.cloudstream3.ui.MaxRecyclerView
|
||||||
android:id="@+id/result_range_selection"
|
android:id="@+id/result_range_selection"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:descendantFocusability="afterDescendants"
|
android:descendantFocusability="afterDescendants"
|
||||||
|
|
||||||
android:nextFocusLeft="@id/result_season_selection"
|
android:nextFocusLeft="@id/result_season_selection"
|
||||||
android:nextFocusRight="@id/result_dub_selection"
|
android:nextFocusRight="@id/result_episodes"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingVertical="@dimen/result_padding"
|
android:paddingVertical="@dimen/result_padding"
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
tools:listitem="@layout/result_selection"
|
tools:listitem="@layout/result_selection"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/result_dub_selection"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:clipToPadding="false"
|
|
||||||
|
|
||||||
android:descendantFocusability="afterDescendants"
|
|
||||||
android:nextFocusLeft="@id/result_range_selection"
|
|
||||||
android:nextFocusRight="@id/result_episodes"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingVertical="@dimen/result_padding"
|
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
|
||||||
tools:listitem="@layout/result_selection" />
|
|
||||||
|
|
||||||
|
|
||||||
<!--<androidx.core.widget.ContentLoadingProgressBar
|
<!--<androidx.core.widget.ContentLoadingProgressBar
|
||||||
android:id="@+id/result_episode_loading"
|
android:id="@+id/result_episode_loading"
|
||||||
|
@ -636,7 +657,7 @@ https://developer.android.com/design/ui/tv/samples/jet-fit
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:descendantFocusability="afterDescendants"
|
android:descendantFocusability="afterDescendants"
|
||||||
android:nextFocusLeft="@id/result_dub_selection"
|
android:nextFocusLeft="@id/result_range_selection"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingVertical="@dimen/result_padding"
|
android:paddingVertical="@dimen/result_padding"
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
|
@ -652,12 +673,12 @@ https://developer.android.com/design/ui/tv/samples/jet-fit
|
||||||
android:nextFocusUp="@id/temporary_no_focus"
|
android:nextFocusUp="@id/temporary_no_focus"
|
||||||
android:nextFocusDown="@id/temporary_no_focus" />
|
android:nextFocusDown="@id/temporary_no_focus" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<androidx.core.widget.NestedScrollView
|
<androidx.core.widget.NestedScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue