diff --git a/components/ButtonGroupVert.bs b/components/ButtonGroupVert.bs new file mode 100644 index 00000000..ce06e415 --- /dev/null +++ b/components/ButtonGroupVert.bs @@ -0,0 +1,44 @@ +sub init() + m.top.layoutDirection = "vert" + m.top.observeField("focusedChild", "onFocusChanged") + m.top.observeField("focusButton", "onFocusButtonChanged") +end sub + +sub onFocusChanged() + if m.top.hasFocus() + m.top.getChild(0).setFocus(true) + m.top.focusButton = 0 + end if +end sub + +sub onFocusButtonChanged() + m.top.getChild(m.top.focusButton).setFocus(true) +end sub + +function onKeyEvent(key as string, press as boolean) as boolean + if key = "OK" + m.top.selected = m.top.focusButton + return true + end if + + if not press then return false + + if key = "down" + i = m.top.focusButton + target = i + 1 + if target >= m.top.getChildCount() then return false + m.top.focusButton = target + return true + else if key = "up" + i = m.top.focusButton + target = i - 1 + if target < 0 then return false + m.top.focusButton = target + return true + else if key = "left" or key = "right" + m.top.escape = key + return true + end if + + return false +end function diff --git a/components/ButtonGroupVert.xml b/components/ButtonGroupVert.xml new file mode 100644 index 00000000..2075dad9 --- /dev/null +++ b/components/ButtonGroupVert.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/components/music/ArtistView.xml b/components/music/ArtistView.xml index c8b9be04..902f79d7 100644 --- a/components/music/ArtistView.xml +++ b/components/music/ArtistView.xml @@ -33,11 +33,11 @@ - + - + diff --git a/package-lock.json b/package-lock.json index 2cb7f1ba..833e8d7c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,6 @@ "license": "GPL-2.0", "dependencies": { "@rokucommunity/bslib": "0.1.1", - "bgv": "npm:button-group-vert@1.0.2", "brighterscript-formatter": "1.6.34", "intKeyboard": "npm:integer-keyboard@1.0.12", "log": "npm:roku-log@0.11.1", @@ -708,12 +707,6 @@ "tweetnacl": "^0.14.3" } }, - "node_modules/bgv": { - "name": "button-group-vert", - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/button-group-vert/-/button-group-vert-1.0.2.tgz", - "integrity": "sha512-pfrUYI/aFubtjhA8I08qNCtDluyIScksldR15icR7Pj24tNELYCYXE7M0jaU7xgdiFAhZJcYuB3aCXzyI1CoMw==" - }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", diff --git a/package.json b/package.json index 00c5e543..db99dd59 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "description": "Roku app for Jellyfin media server", "dependencies": { "@rokucommunity/bslib": "0.1.1", - "bgv": "npm:button-group-vert@1.0.2", "brighterscript-formatter": "1.6.34", "intKeyboard": "npm:integer-keyboard@1.0.12", "log": "npm:roku-log@0.11.1",