* Refactor long press * Lint fix * Queue UI, refactor PlayQueue to use ContentNode * Add queue notification hint * Play at index * Play queue with highlight * Priority * Comment --------- Co-authored-by: github-action linter <githubaction@githubaction.com>
84 lines
2.0 KiB
Plaintext
84 lines
2.0 KiB
Plaintext
import "pkg:/components/Navigation/Navigation.bs"
|
|
import "pkg:/source/utils/FocusManagement.bs"
|
|
import "pkg:/source/utils/Types.bs"
|
|
|
|
function Init()
|
|
m.queueList = m.top.findNode("queueList")
|
|
m.queueLabel = m.top.findNode("queueLabel")
|
|
m.clearButton = m.top.findNode("clearButton")
|
|
m.showAnimation = m.top.findNode("showAnimation")
|
|
|
|
m.clearButton.ObserveField("buttonSelected", FuncName(OnClearButtonSelected))
|
|
m.queueList.ObserveField("itemSelected", FuncName(OnItemSelected))
|
|
|
|
SetNavigation(m.queueList, "up", m.clearButton)
|
|
SetNavigation(m.clearButton, "down", m.queueList)
|
|
end function
|
|
|
|
function Show(unsued as dynamic)
|
|
m.showAnimation.control = "start"
|
|
end function
|
|
|
|
function OnFocusChange() as void
|
|
if not m.top.focus
|
|
return
|
|
end if
|
|
NodeSetFocus(m.queueList, true)
|
|
end function
|
|
|
|
function OnContentSet() as void
|
|
content = m.top.content
|
|
if content = invalid
|
|
return
|
|
end if
|
|
|
|
if not content.isSameNode(m.queueList.content)
|
|
m.queueList.content = content
|
|
end if
|
|
|
|
index = content.index
|
|
if IsInt(index) and index <> -1
|
|
m.queueLabel.text = `Queue (${index + 1}/${content.getChildCount()})`
|
|
else
|
|
m.queueLabel.text = `Queue (${content.getChildCount()})`
|
|
end if
|
|
end function
|
|
|
|
function OnkeyEvent(key as string, press as boolean) as boolean
|
|
if NavigationKeyHandler(key, press).handled
|
|
return true
|
|
end if
|
|
|
|
if press = false
|
|
return false
|
|
end if
|
|
|
|
if key = "back"
|
|
Close()
|
|
return true
|
|
end if
|
|
return false
|
|
end function
|
|
|
|
function Close()
|
|
m.top.appController@.PopScreen(invalid)
|
|
end function
|
|
|
|
function OnClearButtonSelected()
|
|
m.top.playQueue@.Clear(invalid)
|
|
end function
|
|
|
|
function OnItemSelected() as void
|
|
content = m.queueList.content
|
|
if content = invalid
|
|
return
|
|
end if
|
|
|
|
index = m.queueList.itemSelected
|
|
if index < 0 or index >= content.getChildCount()
|
|
return
|
|
end if
|
|
|
|
m.top.playQueue@.PlayItemAtIndex(index)
|
|
end function
|