autohide part 2 fuck android tv

This commit is contained in:
LagradOst 2021-12-11 22:36:35 +01:00
parent dba8e7e70a
commit ef91102daf

View file

@ -1073,30 +1073,6 @@ class PlayerFragment : Fragment() {
private fun handleKeyEvent(event: KeyEvent): Boolean { private fun handleKeyEvent(event: KeyEvent): Boolean {
event.keyCode.let { keyCode -> event.keyCode.let { keyCode ->
when (keyCode) {
// don't allow dpad move when hidden
KeyEvent.KEYCODE_DPAD_LEFT,
KeyEvent.KEYCODE_DPAD_DOWN,
KeyEvent.KEYCODE_DPAD_UP,
KeyEvent.KEYCODE_DPAD_RIGHT,
KeyEvent.KEYCODE_DPAD_DOWN_LEFT,
KeyEvent.KEYCODE_DPAD_DOWN_RIGHT,
KeyEvent.KEYCODE_DPAD_UP_LEFT,
KeyEvent.KEYCODE_DPAD_UP_RIGHT -> {
if (!isShowing) {
return true
}
}
// netflix capture back and hide ~monke
KeyEvent.KEYCODE_BACK -> {
if (isShowing) {
onClickChange()
return true
}
}
}
when (event.action) { when (event.action) {
KeyEvent.ACTION_DOWN -> { KeyEvent.ACTION_DOWN -> {
when (keyCode) { when (keyCode) {
@ -1116,6 +1092,32 @@ class PlayerFragment : Fragment() {
//) //)
} }
} }
when (keyCode) {
// don't allow dpad move when hidden
KeyEvent.KEYCODE_DPAD_LEFT,
KeyEvent.KEYCODE_DPAD_DOWN,
KeyEvent.KEYCODE_DPAD_UP,
KeyEvent.KEYCODE_DPAD_RIGHT,
KeyEvent.KEYCODE_DPAD_DOWN_LEFT,
KeyEvent.KEYCODE_DPAD_DOWN_RIGHT,
KeyEvent.KEYCODE_DPAD_UP_LEFT,
KeyEvent.KEYCODE_DPAD_UP_RIGHT -> {
if (!isShowing) {
return true
} else {
autoHide()
}
}
// netflix capture back and hide ~monke
KeyEvent.KEYCODE_BACK -> {
if (isShowing) {
onClickChange()
return true
}
}
}
} }
return false return false