Merge branch 'recloudstream:master' into master
This commit is contained in:
commit
a640f59c54
|
@ -256,13 +256,14 @@ class HomeFragment : Fragment() {
|
||||||
nsfw: MaterialButton?,
|
nsfw: MaterialButton?,
|
||||||
others: MaterialButton?,
|
others: MaterialButton?,
|
||||||
): List<Pair<MaterialButton?, List<TvType>>> {
|
): List<Pair<MaterialButton?, List<TvType>>> {
|
||||||
|
// This list should be same order as home screen to aid navigation
|
||||||
return listOf(
|
return listOf(
|
||||||
Pair(anime, listOf(TvType.Anime, TvType.OVA, TvType.AnimeMovie)),
|
|
||||||
Pair(cartoons, listOf(TvType.Cartoon)),
|
|
||||||
Pair(tvs, listOf(TvType.TvSeries)),
|
|
||||||
Pair(docs, listOf(TvType.Documentary)),
|
|
||||||
Pair(movies, listOf(TvType.Movie, TvType.Torrent)),
|
Pair(movies, listOf(TvType.Movie, TvType.Torrent)),
|
||||||
|
Pair(tvs, listOf(TvType.TvSeries)),
|
||||||
|
Pair(anime, listOf(TvType.Anime, TvType.OVA, TvType.AnimeMovie)),
|
||||||
Pair(asian, listOf(TvType.AsianDrama)),
|
Pair(asian, listOf(TvType.AsianDrama)),
|
||||||
|
Pair(cartoons, listOf(TvType.Cartoon)),
|
||||||
|
Pair(docs, listOf(TvType.Documentary)),
|
||||||
Pair(livestream, listOf(TvType.Live)),
|
Pair(livestream, listOf(TvType.Live)),
|
||||||
Pair(nsfw, listOf(TvType.NSFW)),
|
Pair(nsfw, listOf(TvType.NSFW)),
|
||||||
Pair(others, listOf(TvType.Others)),
|
Pair(others, listOf(TvType.Others)),
|
||||||
|
@ -352,11 +353,25 @@ class HomeFragment : Fragment() {
|
||||||
arrayAdapter.notifyDataSetChanged()
|
arrayAdapter.notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Since fire tv is fucked we need to manually define the focus layout.
|
||||||
|
* Since visible buttons are only known in runtime this is required.
|
||||||
|
**/
|
||||||
|
var lastButton: MaterialButton? = null
|
||||||
|
|
||||||
for ((button, validTypes) in pairList) {
|
for ((button, validTypes) in pairList) {
|
||||||
val isValid =
|
val isValid =
|
||||||
validAPIs.any { api -> validTypes.any { api.supportedTypes.contains(it) } }
|
validAPIs.any { api -> validTypes.any { api.supportedTypes.contains(it) } }
|
||||||
button?.isVisible = isValid
|
button?.isVisible = isValid
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
|
|
||||||
|
// Set focus navigation
|
||||||
|
button?.let { currentButton ->
|
||||||
|
lastButton?.nextFocusRightId = currentButton.id
|
||||||
|
lastButton?.id?.let { currentButton.nextFocusLeftId = it }
|
||||||
|
lastButton = currentButton
|
||||||
|
}
|
||||||
|
|
||||||
fun buttonContains(): Boolean {
|
fun buttonContains(): Boolean {
|
||||||
return preSelectedTypes.any { validTypes.contains(it) }
|
return preSelectedTypes.any { validTypes.contains(it) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,11 @@
|
||||||
|
|
||||||
android:id="@+id/home_select_none"
|
android:id="@+id/home_select_none"
|
||||||
style="@style/RoundedSelectableButtonIcon"/>-->
|
style="@style/RoundedSelectableButtonIcon"/>-->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
If you reorder this fix getPairList() too!
|
||||||
|
That shit is responsible for focus selection
|
||||||
|
-->
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/home_select_movies"
|
android:id="@+id/home_select_movies"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue