[Android] TV: ignore inputs if fragment is not ready
Geoffrey Métais
git at videolan.org
Wed Jun 5 10:31:23 CEST 2019
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed May 22 10:24:29 2019 +0200| [a7f5fdcae638879ff962ec6e42a2d4e8d5ad0c8b] | committer: Geoffrey Métais
TV: ignore inputs if fragment is not ready
> https://code.videolan.org/videolan/vlc-android/commit/a7f5fdcae638879ff962ec6e42a2d4e8d5ad0c8b
---
.../videolan/vlc/gui/tv/browser/VerticalGridActivity.kt | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/VerticalGridActivity.kt b/vlc-android/src/org/videolan/vlc/gui/tv/browser/VerticalGridActivity.kt
index cec5dbfcb..8512fff4f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/VerticalGridActivity.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/VerticalGridActivity.kt
@@ -88,14 +88,16 @@ class VerticalGridActivity : BaseTvActivity(), BrowserActivityInterface {
}
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
- if (fragment is DetailsFragment && (keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE || keyCode == KeyEvent.KEYCODE_BUTTON_Y || keyCode == KeyEvent.KEYCODE_Y)) {
- (fragment as DetailsFragment).showDetails()
- return true
- }
- if (fragment is OnKeyPressedListener) {
- if ((fragment as OnKeyPressedListener).onKeyPressed(keyCode)) {
+ if (::fragment.isInitialized) {
+ if (fragment is DetailsFragment && (keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE || keyCode == KeyEvent.KEYCODE_BUTTON_Y || keyCode == KeyEvent.KEYCODE_Y)) {
+ (fragment as DetailsFragment).showDetails()
return true
}
+ if (fragment is OnKeyPressedListener) {
+ if ((fragment as OnKeyPressedListener).onKeyPressed(keyCode)) {
+ return true
+ }
+ }
}
return super.onKeyDown(keyCode, event)
}
More information about the Android
mailing list