From 8c0fc20eced8fa244e865c4820bf1aa3f49eb387 Mon Sep 17 00:00:00 2001 From: Charles Ewert Date: Sat, 28 Oct 2023 22:36:35 -0400 Subject: [PATCH 1/7] add quickplay support to search results --- components/search/SearchResults.brs | 6 ++++++ source/ShowScenes.brs | 1 + 2 files changed, 7 insertions(+) diff --git a/components/search/SearchResults.brs b/components/search/SearchResults.brs index 8427232d..f8f18e7b 100644 --- a/components/search/SearchResults.brs +++ b/components/search/SearchResults.brs @@ -60,6 +60,12 @@ function onKeyEvent(key as string, press as boolean) as boolean else if key = "right" m.searchSelect.setFocus(true) return true + else if key = "play" + print "play was pressed from search results" + if m.searchSelect.rowItemFocused <> invalid + m.top.quickPlayNode = m.searchSelect.content.getChild(m.searchSelect.rowItemFocused[0]).getChild(m.searchSelect.rowItemFocused[1]) + return true + end if end if return false diff --git a/source/ShowScenes.brs b/source/ShowScenes.brs index ebac0c58..e8664378 100644 --- a/source/ShowScenes.brs +++ b/source/ShowScenes.brs @@ -855,6 +855,7 @@ end function function CreateSearchPage() ' Search + Results Page group = CreateObject("roSGNode", "searchResults") + group.observeField("quickPlayNode", m.port) options = group.findNode("searchSelect") options.observeField("itemSelected", m.port) From 187a0528ef80d8a5a9ef9537b7cf343e3cd85b10 Mon Sep 17 00:00:00 2001 From: Charles Ewert Date: Sun, 29 Oct 2023 15:12:37 -0400 Subject: [PATCH 2/7] precent focusing on the search results until there is data --- components/search/SearchResults.brs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/search/SearchResults.brs b/components/search/SearchResults.brs index f8f18e7b..07ce4f9a 100644 --- a/components/search/SearchResults.brs +++ b/components/search/SearchResults.brs @@ -57,7 +57,7 @@ function onKeyEvent(key as string, press as boolean) as boolean if key = "left" and m.searchSelect.isinFocusChain() m.searchAlphabox.setFocus(true) return true - else if key = "right" + else if key = "right" and m.searchHelpText.visible = false m.searchSelect.setFocus(true) return true else if key = "play" From a942cb5efd3d9cbe691be6ba541aaf0d7479b0e1 Mon Sep 17 00:00:00 2001 From: Charles Ewert Date: Sun, 29 Oct 2023 15:22:03 -0400 Subject: [PATCH 3/7] use TotalRecordCount to check search results state --- components/search/SearchResults.brs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/search/SearchResults.brs b/components/search/SearchResults.brs index 07ce4f9a..34ce62a7 100644 --- a/components/search/SearchResults.brs +++ b/components/search/SearchResults.brs @@ -57,7 +57,7 @@ function onKeyEvent(key as string, press as boolean) as boolean if key = "left" and m.searchSelect.isinFocusChain() m.searchAlphabox.setFocus(true) return true - else if key = "right" and m.searchHelpText.visible = false + else if key = "right" and m.searchSelect.itemdata <> invalid and m.searchSelect.itemdata.TotalRecordCount > 0 m.searchSelect.setFocus(true) return true else if key = "play" From c0f2b7fc0a9728454190616ae4aaa3e93f2bba47 Mon Sep 17 00:00:00 2001 From: Charles Ewert Date: Tue, 31 Oct 2023 13:30:46 -0400 Subject: [PATCH 4/7] address reviewer feedback --- components/search/SearchResults.brs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/search/SearchResults.brs b/components/search/SearchResults.brs index 34ce62a7..fe7545af 100644 --- a/components/search/SearchResults.brs +++ b/components/search/SearchResults.brs @@ -60,7 +60,7 @@ function onKeyEvent(key as string, press as boolean) as boolean else if key = "right" and m.searchSelect.itemdata <> invalid and m.searchSelect.itemdata.TotalRecordCount > 0 m.searchSelect.setFocus(true) return true - else if key = "play" + else if key = "play" and m.searchSelect.rowItemFocused.count() > 0 print "play was pressed from search results" if m.searchSelect.rowItemFocused <> invalid m.top.quickPlayNode = m.searchSelect.content.getChild(m.searchSelect.rowItemFocused[0]).getChild(m.searchSelect.rowItemFocused[1]) From bd9a4516013c679e8d2d021dc3813d5c5eb1283a Mon Sep 17 00:00:00 2001 From: Charles Ewert Date: Tue, 31 Oct 2023 15:08:03 -0400 Subject: [PATCH 5/7] only quickplay on search page if search results are in focus --- components/search/SearchResults.brs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/search/SearchResults.brs b/components/search/SearchResults.brs index fe7545af..cebeff1e 100644 --- a/components/search/SearchResults.brs +++ b/components/search/SearchResults.brs @@ -60,7 +60,7 @@ function onKeyEvent(key as string, press as boolean) as boolean else if key = "right" and m.searchSelect.itemdata <> invalid and m.searchSelect.itemdata.TotalRecordCount > 0 m.searchSelect.setFocus(true) return true - else if key = "play" and m.searchSelect.rowItemFocused.count() > 0 + else if key = "play" and m.searchSelect.isinFocusChain() and m.searchSelect.rowItemFocused.count() > 0 print "play was pressed from search results" if m.searchSelect.rowItemFocused <> invalid m.top.quickPlayNode = m.searchSelect.content.getChild(m.searchSelect.rowItemFocused[0]).getChild(m.searchSelect.rowItemFocused[1]) From 034c485990f63629fa3514b834a788e40abcd3ba Mon Sep 17 00:00:00 2001 From: Charles Ewert Date: Tue, 31 Oct 2023 15:26:54 -0400 Subject: [PATCH 6/7] use child count to track state of search results --- components/search/SearchResults.brs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/search/SearchResults.brs b/components/search/SearchResults.brs index cebeff1e..42683e26 100644 --- a/components/search/SearchResults.brs +++ b/components/search/SearchResults.brs @@ -57,7 +57,7 @@ function onKeyEvent(key as string, press as boolean) as boolean if key = "left" and m.searchSelect.isinFocusChain() m.searchAlphabox.setFocus(true) return true - else if key = "right" and m.searchSelect.itemdata <> invalid and m.searchSelect.itemdata.TotalRecordCount > 0 + else if key = "right" and m.searchSelect.content <> invalid and m.searchSelect.content.getChildCount() > 0 m.searchSelect.setFocus(true) return true else if key = "play" and m.searchSelect.isinFocusChain() and m.searchSelect.rowItemFocused.count() > 0 From fd9b50ca3feddad13c7981ce7d69282e5f82530e Mon Sep 17 00:00:00 2001 From: Charles Ewert Date: Tue, 31 Oct 2023 16:11:56 -0400 Subject: [PATCH 7/7] validate search quick play node and return focus after a query with no results --- components/search/SearchResults.brs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/components/search/SearchResults.brs b/components/search/SearchResults.brs index 42683e26..0eddf058 100644 --- a/components/search/SearchResults.brs +++ b/components/search/SearchResults.brs @@ -41,6 +41,13 @@ sub loadResults() m.searchSelect.itemdata = m.searchTask.results m.searchSelect.query = m.top.SearchAlpha m.searchHelpText.visible = false + if m.searchTask.results.TotalRecordCount = 0 + ' make sure focus is on the keyboard + if m.searchSelect.isinFocusChain() + m.searchAlphabox.setFocus(true) + end if + return + end if m.searchAlphabox = m.top.findnode("searchResults") m.searchAlphabox.translation = "[470, 85]" end sub @@ -63,8 +70,14 @@ function onKeyEvent(key as string, press as boolean) as boolean else if key = "play" and m.searchSelect.isinFocusChain() and m.searchSelect.rowItemFocused.count() > 0 print "play was pressed from search results" if m.searchSelect.rowItemFocused <> invalid - m.top.quickPlayNode = m.searchSelect.content.getChild(m.searchSelect.rowItemFocused[0]).getChild(m.searchSelect.rowItemFocused[1]) - return true + selectedContent = m.searchSelect.content.getChild(m.searchSelect.rowItemFocused[0]) + if selectedContent <> invalid + selectedItem = selectedContent.getChild(m.searchSelect.rowItemFocused[1]) + if selectedItem <> invalid + m.top.quickPlayNode = selectedItem + return true + end if + end if end if end if return false