2019-05-03 12:48:59 +00:00
|
|
|
sub init()
|
|
|
|
m.title = m.top.findNode("title")
|
2020-05-29 16:47:16 +00:00
|
|
|
m.staticTitle = m.top.findNode("staticTitle")
|
2019-05-03 12:48:59 +00:00
|
|
|
m.poster = m.top.findNode("poster")
|
2021-07-09 20:08:32 +00:00
|
|
|
|
2019-05-03 12:48:59 +00:00
|
|
|
m.backdrop = m.top.findNode("backdrop")
|
2021-07-09 20:08:32 +00:00
|
|
|
|
2020-05-31 13:47:03 +00:00
|
|
|
' Randmomise the background colors
|
2020-08-16 14:44:03 +00:00
|
|
|
posterBackgrounds = m.global.constants.poster_bg_pallet
|
2020-05-31 13:47:03 +00:00
|
|
|
m.backdrop.color = posterBackgrounds[rnd(posterBackgrounds.count()) - 1]
|
|
|
|
|
2019-05-03 12:48:59 +00:00
|
|
|
updateSize()
|
|
|
|
end sub
|
|
|
|
|
|
|
|
sub updateSize()
|
|
|
|
|
2019-05-10 04:24:19 +00:00
|
|
|
image = invalid
|
|
|
|
if m.top.itemContent <> invalid and m.top.itemContent.image <> invalid
|
2021-07-09 20:08:32 +00:00
|
|
|
image = m.top.itemContent.image
|
2019-05-10 04:24:19 +00:00
|
|
|
end if
|
|
|
|
|
|
|
|
if image = invalid
|
2021-07-09 20:08:32 +00:00
|
|
|
m.backdrop.visible = true
|
2019-05-10 04:24:19 +00:00
|
|
|
else
|
2021-07-09 20:08:32 +00:00
|
|
|
m.backdrop.visible = false
|
2019-05-10 04:24:19 +00:00
|
|
|
end if
|
|
|
|
|
2019-05-03 12:48:59 +00:00
|
|
|
' TODO - abstract this in case the parent doesnt have itemSize
|
|
|
|
maxSize = m.top.getParent().itemSize
|
|
|
|
|
2019-05-10 04:24:19 +00:00
|
|
|
' Always reserve the bottom for the Poster Title
|
2020-05-29 16:47:16 +00:00
|
|
|
m.title.maxWidth = maxSize[0]
|
2022-04-19 16:50:34 +00:00
|
|
|
m.title.height = 40
|
|
|
|
m.title.translation = [0, int(maxSize[1]) - m.title.height + 5]
|
2022-04-15 02:50:47 +00:00
|
|
|
print "[0," int(maxSize[1]) - m.title.height"]"
|
2019-05-10 04:24:19 +00:00
|
|
|
|
2020-05-29 16:47:16 +00:00
|
|
|
m.staticTitle.width = maxSize[0]
|
2022-04-19 16:50:34 +00:00
|
|
|
m.staticTitle.height = m.title.height
|
|
|
|
m.staticTitle.translation = m.title.translation
|
2019-05-10 04:24:19 +00:00
|
|
|
|
2019-05-03 12:48:59 +00:00
|
|
|
m.poster.width = int(maxSize[0]) - 4
|
2022-04-19 16:50:34 +00:00
|
|
|
m.poster.height = int(maxSize[1]) - m.title.height 'Set poster height to available space
|
2019-05-03 12:48:59 +00:00
|
|
|
|
2022-04-19 16:50:34 +00:00
|
|
|
|
|
|
|
|
2019-05-03 12:48:59 +00:00
|
|
|
m.backdrop.width = m.poster.width
|
|
|
|
m.backdrop.height = m.poster.height
|
|
|
|
|
|
|
|
end sub
|
|
|
|
|
2021-06-26 10:18:09 +00:00
|
|
|
sub itemContentChanged() as void
|
2021-07-09 20:08:32 +00:00
|
|
|
m.poster = m.top.findNode("poster")
|
|
|
|
itemData = m.top.itemContent
|
|
|
|
m.title.text = itemData.title
|
|
|
|
if itemData.json.lookup("Type") = "Episode" and itemData.json.IndexNumber <> invalid
|
|
|
|
m.title.text = StrI(itemData.json.IndexNumber) + ". " + m.title.text
|
|
|
|
end if
|
|
|
|
m.staticTitle.text = m.title.text
|
2020-05-29 16:47:16 +00:00
|
|
|
|
2021-07-09 20:08:32 +00:00
|
|
|
m.poster.uri = itemData.posterUrl
|
2019-05-03 12:48:59 +00:00
|
|
|
|
2021-07-09 20:08:32 +00:00
|
|
|
updateSize()
|
2021-06-26 10:18:09 +00:00
|
|
|
end sub
|
2020-05-29 16:47:16 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
' Enable title scrolling based on item Focus
|
|
|
|
sub focusChanged()
|
|
|
|
|
2021-07-09 20:08:32 +00:00
|
|
|
if m.top.itemHasFocus = true
|
|
|
|
m.title.repeatCount = -1
|
|
|
|
m.staticTitle.visible = false
|
|
|
|
m.title.visible = true
|
2020-05-29 16:47:16 +00:00
|
|
|
|
2021-07-09 20:08:32 +00:00
|
|
|
else
|
|
|
|
m.title.repeatCount = 0
|
|
|
|
m.staticTitle.visible = true
|
|
|
|
m.title.visible = false
|
|
|
|
end if
|
2020-05-29 16:47:16 +00:00
|
|
|
|
|
|
|
end sub
|