jf-roku/components/ItemGrid2/GridItem.brs

68 lines
1.7 KiB
Plaintext
Raw Normal View History

sub init()
m.posterMask = m.top.findNode("posterMask")
m.itemPoster = m.top.findNode("itemPoster")
m.posterText = m.top.findNode("posterText")
m.itemText = m.top.findNode("itemText")
m.backdrop = m.top.findNode("backdrop")
m.itemPoster.observeField("loadStatus", "onPosterLoadStatusChanged")
m.itemText.translation = [0, m.itemPoster.height + 7]
end sub
sub itemContentChanged()
' Set Randmom background colors from pallet
posterBackgrounds = m.global.poster_bg_pallet
m.backdrop.color = posterBackgrounds[rnd(posterBackgrounds.count()) - 1]
itemData = m.top.itemContent
if itemData = invalid then return
if itemData.type = "Movie" then
m.itemPoster.uri = itemData.PosterUrl
m.itemText.text = itemData.Title
2020-06-15 16:05:48 +00:00
else if itemData.type = "Series" then
m.itemPoster.uri = itemData.PosterUrl
2020-06-15 16:05:48 +00:00
m.itemText.text = itemData.Title
else if itemData.type = "Boxset" then
m.itemPoster.uri = itemData.PosterUrl
m.itemText.text = itemData.Title
else
print "Unhandled Item Type: " + itemData.type
end if
m.posterText.text = m.itemText.text
end sub
'
2020-06-11 06:57:31 +00:00
'Use FocusPercent to animate scaling of Poser Image
sub focusChanging()
scaleFactor = 0.85 + (m.top.focusPercent * 0.15)
m.posterMask.scale = [scaleFactor, scaleFactor]
2020-06-11 06:57:31 +00:00
end sub
'
'Display or hide title Visibility on focus change
sub focusChanged()
if m.top.itemHasFocus = true then
m.itemText.visible = true
m.itemText.repeatCount = -1
else
m.itemText.visible = false
m.itemText.repeatCount = 0
end if
end sub
'Hide backdrop and text when poster loaded
sub onPosterLoadStatusChanged()
if m.itemPoster.loadStatus = "ready" then
m.backdrop.visible = false
m.posterText.visible = false
end if
end sub