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