* Dial+Lounge API PoC * format * Fix for chrome * comments * Rate limit and logger stuff * rename route * remove invalid routes * remove device image * Simplify device description * command test * Lint fix * register pairing code * tv code UI * Lint fix * Avoid creating lots of objects * dpad command * small refactor * tweak * validation * timer * fix * Revert "timer" This reverts commit e349565910882408898c9bddda55dadaa9d743de. * Commands * setVolume command * lounge service timer * Some state messages * Lint fix * player state sync * voice handler * Adjustments, and add a TODO list * Lint fix * comment * play at timestamp * Remote screen UI * UI adjustment * Small refactor * Refactor long polling * Add TODO * Manage logging a bit better to avoid spam in DIAL server * cache dial file * logging * comment * Join lounge lazily * long poller tweak * ui tweak * set shouldQuit field * remote connect notification * Lint fix * Randomize device id, new device on start * Lint fix * Lounge disconnect on start * Speed up lounge by not blocking on sent messages * add version to lounge data saved * dial server fix rendezvous * todo * no message * Display network name * playlist changes * Lint fix * tweak params * tweak * player state * comments * Refactor Video Queue (#295) * Refactor Video Queue * Video queue and playlists * Web app casting * queue playlist notification * VideoQueueView work * restore properties * changes * queue notification and previous/next state * Lint fix * very basic error handling * Update changelog and privacy policy --------- Co-authored-by: github-action linter <githubaction@githubaction.com>
72 lines
2.0 KiB
Plaintext
72 lines
2.0 KiB
Plaintext
import "pkg:/components/Navigation/Navigation.bs"
|
|
import "pkg:/source/utils/FocusManagement.bs"
|
|
import "pkg:/source/utils/MathUtils.bs"
|
|
import "pkg:/source/utils/Types.bs"
|
|
|
|
function Init()
|
|
m.top.focusable = true
|
|
m.top.itemSpacings = [10]
|
|
|
|
m.minusButton = m.top.findNode("MinusButton")
|
|
m.numberButton = m.top.findNode("NumberButton")
|
|
m.plusButton = m.top.findNode("PlusButton")
|
|
|
|
m.minusButton.observeFieldScoped("buttonSelected", FuncName(OnMinusSelected))
|
|
m.plusButton.observeFieldScoped("buttonSelected", FuncName(OnPlusSelected))
|
|
|
|
SetNavigation(m.minusButton, "right", m.numberButton)
|
|
SetNavigation(m.numberButton, "left", m.minusButton)
|
|
SetNavigation(m.numberButton, "right", m.plusButton)
|
|
SetNavigation(m.plusButton, "left", m.numberButton)
|
|
end function
|
|
|
|
function BindPreference(preferences as object, key as string)
|
|
if m.preferences <> invalid and m.key <> invalid
|
|
m.preferences.unobserveFieldScoped(m.key)
|
|
end if
|
|
|
|
m.preferences = preferences
|
|
m.key = key
|
|
|
|
if preferences <> invalid and key <> invalid
|
|
preferences.observeFieldScoped(key, FuncName(OnPreferenceChange))
|
|
OnPreferenceChange()
|
|
end if
|
|
end function
|
|
|
|
function OnPreferenceChange()
|
|
m.top.value = MathUtils.Clamp(m.preferences[m.key], m.top.min, m.top.max)
|
|
end function
|
|
|
|
function OnValueChange() as void
|
|
m.numberButton.text = `${m.top.value}`
|
|
if m.preferences = invalid or m.key = invalid
|
|
return
|
|
end if
|
|
|
|
m.preferences[m.key] = m.top.value
|
|
end function
|
|
|
|
function OnFocusChange() as void
|
|
if not m.top.focus
|
|
return
|
|
end if
|
|
|
|
NodeSetFocus(m.numberButton, true)
|
|
end function
|
|
|
|
function OnkeyEvent(key as string, press as boolean) as boolean
|
|
if NavigationKeyHandler(key, press).handled
|
|
return true
|
|
end if
|
|
return false
|
|
end function
|
|
|
|
function OnMinusSelected()
|
|
m.top.value = MathUtils.Max(m.top.value - 1, m.top.min)
|
|
end function
|
|
|
|
function OnPlusSelected()
|
|
m.top.value = MathUtils.Min(m.top.value + 1, m.top.max)
|
|
end function
|