From 4f4b1d574874a286d881ab5dfbb4030dbe7d404f Mon Sep 17 00:00:00 2001 From: 1hitsong <3330318+1hitsong@users.noreply.github.com> Date: Fri, 9 Dec 2022 20:26:32 -0500 Subject: [PATCH] Fix TV Episode focus issues 1. Pressing back on resume dialog on episode list 2. Choosing resume and pressing back from video playback --- components/tvshows/TVEpisodes.brs | 1 + source/Main.brs | 7 +++++++ source/utils/misc.brs | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/components/tvshows/TVEpisodes.brs b/components/tvshows/TVEpisodes.brs index 915aeb97..d063b9ef 100644 --- a/components/tvshows/TVEpisodes.brs +++ b/components/tvshows/TVEpisodes.brs @@ -54,6 +54,7 @@ function onKeyEvent(key as string, press as boolean) as boolean end if if press and key = "play" or proceed = true + m.top.lastFocus = focusedChild itemToPlay = focusedChild.content.getChild(focusedChild.rowItemFocused[0]).getChild(0) if itemToPlay <> invalid and itemToPlay.id <> "" m.top.quickPlayNode = itemToPlay diff --git a/source/Main.brs b/source/Main.brs index 839139b4..b195baee 100644 --- a/source/Main.brs +++ b/source/Main.brs @@ -95,6 +95,13 @@ sub Main (args as dynamic) as void if video <> invalid and video.errorMsg <> "introaborted" sceneManager.callFunc("pushScene", video) end if + + group = sceneManager.callFunc("getActiveScene") + if LCase(group.subtype()) = "tvepisodes" + if isValid(group.lastFocus) + group.lastFocus.setFocus(true) + end if + end if end if else if isNodeEvent(msg, "selectedItem") ' If you select a library from ANYWHERE, follow this flow diff --git a/source/utils/misc.brs b/source/utils/misc.brs index 31b80f36..04d5c568 100644 --- a/source/utils/misc.brs +++ b/source/utils/misc.brs @@ -91,6 +91,12 @@ function get_dialog_result(dialog, port) end function function lastFocusedChild(obj as object) as object + if LCase(obj.focusedChild.focusedChild.subType()) = "tvepisodes" + if isValid(obj?.focusedChild?.focusedChild?.lastFocus) + return obj.focusedChild.focusedChild.lastFocus + end if + end if + child = obj for i = 0 to obj.getChildCount() if obj.focusedChild <> invalid