jf-roku/components/music/AlbumGrid.brs

54 lines
1.3 KiB
Plaintext
Raw Normal View History

2022-07-19 02:28:06 +00:00
sub init()
getData()
end sub
function getData()
' If we have no album data, return a blank node
if m.top.MusicArtistAlbumData = invalid
data = CreateObject("roSGNode", "ContentNode")
return data
end if
albumData = m.top.MusicArtistAlbumData
data = CreateObject("roSGNode", "ContentNode")
for each album in albumData.items
gridAlbum = CreateObject("roSGNode", "ContentNode")
gridAlbum.shortdescriptionline1 = album.title
gridAlbum.HDGRIDPOSTERURL = album.posterURL
gridAlbum.hdposterurl = album.posterURL
gridAlbum.SDGRIDPOSTERURL = album.SDGRIDPOSTERURL
gridAlbum.sdposterurl = album.posterURL
data.appendChild(gridAlbum)
end for
m.top.content = data
return data
end function
function onKeyEvent(key as string, press as boolean) as boolean
if not press then return false
if key = "up"
if m.top.itemFocused <= 4
2022-09-03 20:06:57 +00:00
m.top.escape = key
return true
end if
else if key = "left"
if m.top.itemFocused mod 5 = 0
m.top.escape = key
return true
end if
else if key = "right"
if m.top.itemFocused + 1 mod 5 = 0
m.top.escape = key
2022-07-19 02:28:06 +00:00
return true
end if
end if
return false
end function