Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add quickplay support to search results #1456

Merged
merged 7 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion components/search/SearchResults.brs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -57,9 +64,21 @@ 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.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
1hitsong marked this conversation as resolved.
Show resolved Hide resolved
print "play was pressed from search results"
if m.searchSelect.rowItemFocused <> invalid
cewert marked this conversation as resolved.
Show resolved Hide resolved
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

Expand Down
1 change: 1 addition & 0 deletions source/ShowScenes.brs
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down