* Fresh start * Create an xml include plugin (#111) * Restructure and add testing (#114) * rooibos setup * Restructure and add testing * docs * Restore manifestpipi * Description in tools * A bit of docs * Auto bind feature (#115) * Auto bind feature * Fix children merge * bs plugin fix * Feature/app controller (#120) * Initial layout * Restructuring and plugin work * A couple of tweaks in binding stuff * tweaks * basic stack * Add basic app controller * Support json5/yaml in playlet config files (#123) * Support json5 in playlet config files * Add yaml to the mix * Delete old lib project * plugin fix * plugin tweak * verbose logging * Revert "verbose logging" This reverts commit 25867f4226703d83102519a0d48d1cc46a9876de. * One idea to fix the include plugin * Fix instability in plugins * Feature/navbar (#126) * Navbar * typo * comment * Single content node, and tests * Remove unused field * tweaks * update dependencies command * tweak formatting * Add web app screen * Set id in created screens * Search screen * Tests * Show playlists and channels in search results * Move screen stuff to app controller * Home screen (wip) * Add preferences node * README.md copyedits (#130) * README.md: Fix typos * README.md: Standardize capitalization and punctuation * Update docs/README.md --------- Co-authored-by: Brahim Hadriche <brahim.hadriche@gmail.com> * Web server: round 1 (#131) * web server object * Logging * Web server round 1 * Lint fix * Small tweaks --------- Co-authored-by: github-action linter <githubaction@githubaction.com> * Logging to file * Leftover * Add logs file to web server * Fix for timeout * Disable keepalive connection * add openapi spec file * Lint fix * add prefs version in api * Add ecp api definition * Lint fix * Settings rework (#135) * Settings rework * Standard OnFocusChange event * Video player stuff (#136) * Video player stuff * Restructure things so that focus is better handled * Lint fix --------- Co-authored-by: github-action linter <githubaction@githubaction.com> * Exit dialog * A bunch of changes * New http client * Set TODO priorities * picture in picture * mark video watched * Video player stuff mostly there * update spec file * Sponsorblock * FuncName * SponsorBlock notifications * Lint fix * misc * remove basic auth feature flag (until we start using it) * Play queue part 1 * type fix * handle unicode in request body * SponsorBlock chapter label * modal base * remove a hack * Invidious settings * web server reduce timeout * Test for captions * Lint fix * remove rpc stuff * small change * Solve focus management * a couple of fixes * Remove a bunch of todos * feed error handling wip * Lint fix * navigation in instance settings * home screen pagination support * Refactor feed to support pagination on search page * cell loading animation * Tweak caching * delete test screen * playlist support part 1 * Basic playlist view * Restore playlist/channel handler * Refactor some content node stuff, and add an auth popup dialog * A bad implementation of a playqueue * Lint fix * playlist cast fix * Feature/web app catch up (#139) * playlist cast fix * Move things around * support playlists in web app * update api * Bump deps * Downgrade todo --------- Co-authored-by: Bryce Harrington <bryce@bryceharrington.org> Co-authored-by: github-action linter <githubaction@githubaction.com>
124 lines
3.2 KiB
Plaintext
124 lines
3.2 KiB
Plaintext
import "pkg:/source/utils/ColorUtils.bs"
|
|
import "pkg:/source/utils/FocusManagement.bs"
|
|
import "pkg:/source/utils/Types.bs"
|
|
|
|
function Init()
|
|
end function
|
|
|
|
function OnNodeReady()
|
|
PopulateButtons()
|
|
m.top.observeField("focusedChild", FuncName(OnFocusedChildChange))
|
|
m.top.observeField("items", FuncName(PopulateButtons))
|
|
end function
|
|
|
|
function OnFocusedChildChange()
|
|
m.top.focusIndex = m.top.focusIndex
|
|
end function
|
|
|
|
function PopulateButtons() as void
|
|
buttonCount = m.buttonGroup.getChildCount()
|
|
if buttonCount > 0
|
|
m.buttonGroup.removeChildrenIndex(buttonCount, 0)
|
|
end if
|
|
|
|
if m.top.items = invalid
|
|
m.top.focusable = false
|
|
return
|
|
end if
|
|
|
|
navBarItems = m.top.items.getChildren(-1, 0)
|
|
|
|
buttons = []
|
|
for each item in navBarItems
|
|
button = CreateObject("roSGNode", "IconButton")
|
|
button.background = ColorUtils.HexToInt("242424")
|
|
button.focusBackground = ColorUtils.HexToInt("ff1c30")
|
|
button.padding = 20
|
|
button.height = 50
|
|
button.width = 90
|
|
|
|
button.icon = item.icon
|
|
button.text = item.text
|
|
|
|
buttons.push(button)
|
|
end for
|
|
m.buttonGroup.appendChildren(buttons)
|
|
|
|
m.top.focusable = buttons.Count() > 0
|
|
|
|
m.top.focusIndex = m.top.focusIndex
|
|
end function
|
|
|
|
function onKeyEvent(key as string, press as boolean) as boolean
|
|
if not press
|
|
return false
|
|
end if
|
|
if key = "down"
|
|
i = m.top.focusIndex
|
|
target = i + 1
|
|
if target >= m.buttonGroup.getChildCount()
|
|
return false
|
|
end if
|
|
m.top.focusIndex = target
|
|
return true
|
|
else if key = "up"
|
|
i = m.top.focusIndex
|
|
target = i - 1
|
|
if target < 0
|
|
return false
|
|
end if
|
|
m.top.focusIndex = target
|
|
return true
|
|
else if key = "right"
|
|
if m.top.items = invalid or m.top.focusIndex = -1 or m.top.focusIndex >= m.top.items.getChildCount()
|
|
return false
|
|
end if
|
|
navBarItem = m.top.items.getChild(m.top.focusIndex)
|
|
if navBarItem.canFocus <> true
|
|
return false
|
|
end if
|
|
screen = m.appController@.GetRootScreen(navBarItem.screen)
|
|
if screen = invalid
|
|
return false
|
|
end if
|
|
NodeSetFocus(screen, true)
|
|
return true
|
|
end if
|
|
|
|
return false
|
|
end function
|
|
|
|
function OnFocusIndexChange() as void
|
|
if m.top.items = invalid
|
|
return
|
|
end if
|
|
|
|
buttonCount = m.buttonGroup.getChildCount()
|
|
if buttonCount = 0
|
|
return
|
|
end if
|
|
focusIndex = m.top.focusIndex
|
|
if focusIndex < 0
|
|
m.top.focusIndex = 0
|
|
return
|
|
end if
|
|
if focusIndex >= buttonCount
|
|
m.top.focusIndex = buttonCount - 1
|
|
return
|
|
end if
|
|
|
|
navBarItems = m.top.items.getChildren(-1, 0)
|
|
|
|
buttons = m.buttonGroup.getChildren(-1, 0)
|
|
for i = 0 to buttonCount - 1
|
|
if i <> focusIndex
|
|
buttons[i].focus = false
|
|
m.appController@.HideRootScreen(navBarItems[i].screen)
|
|
end if
|
|
end for
|
|
if focusIndex <> -1
|
|
m.buttonGroup.getChild(focusIndex).focus = m.top.hasFocus()
|
|
m.appController@.ShowRootScreen(navBarItems[focusIndex].screen)
|
|
end if
|
|
end function
|