* Empty bookmarks screen * Bookmarks object * Long press support * Lint fix * Context menu v1 * A working context menu * Basic bookmarks in context menu * Use a root content node for bookmarks * context menu animation * small tweak * move logger around, adjust animation * Lint fix * Restore logger fix * Cache channel info * Bookmarks v1 * Added comment * Adjust "popular" feed error handling * Progress with bookmarks * Add todo * add todo * handle roDateTime logging * logger adjustment * Use yaml for api and layout * rename requestData to feedSource * Restructure things * Lint fix * remove comment * introduce feedSource id * small cleanup * playlist context menu * Context menu for the channel view * changelog --------- Co-authored-by: github-action linter <githubaction@githubaction.com>
72 lines
2.1 KiB
Plaintext
72 lines
2.1 KiB
Plaintext
import "pkg:/source/utils/Types.bs"
|
|
|
|
' Based on https://github.com/jellyfin/jellyfin-roku/blob/unstable/components/IconButton.brs
|
|
function init()
|
|
m.buttonBackground = m.top.findNode("buttonBackground")
|
|
m.buttonIcon = m.top.findNode("buttonIcon")
|
|
m.buttonText = m.top.findNode("buttonText")
|
|
|
|
m.top.observeField("background", FuncName(onBackgroundChanged))
|
|
m.top.observeField("icon", FuncName(onIconChanged))
|
|
m.top.observeField("text", FuncName(onTextChanged))
|
|
m.top.observeField("height", FuncName(onHeightChanged))
|
|
m.top.observeField("width", FuncName(onWidthChanged))
|
|
m.top.observeField("padding", FuncName(onPaddingChanged))
|
|
end function
|
|
|
|
function OnFocusChange()
|
|
if m.top.focus
|
|
m.buttonBackground.blendColor = m.top.focusBackground
|
|
else
|
|
m.buttonBackground.blendColor = m.top.background
|
|
end if
|
|
m.buttonBackground.visible = m.top.focus
|
|
m.buttonText.visible = m.top.focus
|
|
end function
|
|
|
|
function onBackgroundChanged()
|
|
m.buttonBackground.blendColor = m.top.background
|
|
end function
|
|
|
|
function onIconChanged()
|
|
m.buttonIcon.uri = m.top.icon
|
|
end function
|
|
|
|
function onTextChanged()
|
|
m.buttonText.text = m.top.text
|
|
end function
|
|
|
|
function setIconSize()
|
|
height = m.top.height
|
|
width = m.top.width
|
|
if height > 0 and width > 0
|
|
' TODO: Use smallest number between them
|
|
m.buttonIcon.height = m.top.height
|
|
|
|
if m.top.padding > 0
|
|
m.buttonIcon.height = m.buttonIcon.height - m.top.padding
|
|
end if
|
|
|
|
m.buttonIcon.width = m.buttonIcon.height
|
|
|
|
m.buttonIcon.translation = [((width - m.buttonIcon.width) / 2), ((height - m.buttonIcon.height) / 2)]
|
|
m.buttonText.translation = [-5, height]
|
|
m.buttonText.width = width + 10
|
|
end if
|
|
end function
|
|
|
|
function onHeightChanged()
|
|
m.buttonBackground.height = m.top.height
|
|
setIconSize()
|
|
end function
|
|
|
|
function onWidthChanged()
|
|
m.buttonBackground.width = m.top.width - 10
|
|
m.buttonBackground.translation = [5, 0]
|
|
setIconSize()
|
|
end function
|
|
|
|
function onPaddingChanged()
|
|
setIconSize()
|
|
end function
|