forked from recloudstream/cloudstream
Probable fix for Fire TV home provider categories selection
This commit is contained in:
parent
2a6d20cab4
commit
3bea7f01ef
1 changed files with 14 additions and 0 deletions
|
@ -352,11 +352,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) }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue