2019-05-03 12:48:59 +00:00
|
|
|
sub init()
|
|
|
|
m.title = m.top.findNode("title")
|
2019-05-10 04:24:19 +00:00
|
|
|
m.title.translation = [2, 0]
|
|
|
|
|
2019-05-03 12:48:59 +00:00
|
|
|
m.poster = m.top.findNode("poster")
|
2019-05-10 04:24:19 +00:00
|
|
|
m.poster.translation = [2, 0]
|
|
|
|
|
2019-05-03 12:48:59 +00:00
|
|
|
m.backdrop = m.top.findNode("backdrop")
|
|
|
|
|
|
|
|
m.backdrop.color = "#404040FF"
|
|
|
|
|
|
|
|
updateSize()
|
|
|
|
end sub
|
|
|
|
|
|
|
|
sub updateSize()
|
|
|
|
m.title = m.top.findNode("title")
|
|
|
|
m.poster = m.top.findNode("poster")
|
|
|
|
m.backdrop = m.top.findNode("backdrop")
|
|
|
|
|
2019-05-10 04:24:19 +00:00
|
|
|
image = invalid
|
|
|
|
if m.top.itemContent <> invalid and m.top.itemContent.image <> invalid
|
|
|
|
image = m.top.itemContent.image
|
|
|
|
end if
|
|
|
|
|
|
|
|
if image = invalid
|
|
|
|
m.backdrop.visible = true
|
|
|
|
else
|
|
|
|
m.backdrop.visible = false
|
|
|
|
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
|
|
|
|
m.title.wrap = true
|
|
|
|
m.title.maxLines = 2
|
2019-05-10 04:49:34 +00:00
|
|
|
m.title.width = maxSize[0]
|
2019-05-10 04:24:19 +00:00
|
|
|
m.title.height = 80
|
|
|
|
m.title.translation = [0, int(maxSize[1]) - m.title.height]
|
|
|
|
|
|
|
|
ratio = 1.5
|
2019-05-30 22:38:02 +00:00
|
|
|
if image <> invalid and image.width <> 0 and image.height <> 0
|
2019-05-10 04:24:19 +00:00
|
|
|
ratio = image.height / image.width
|
|
|
|
end if
|
|
|
|
|
2019-05-03 12:48:59 +00:00
|
|
|
m.poster.width = int(maxSize[0]) - 4
|
2019-05-10 04:24:19 +00:00
|
|
|
m.poster.height = m.poster.width * ratio
|
|
|
|
|
|
|
|
posterVertSpace = int(maxSize[1]) - m.title.height
|
|
|
|
|
|
|
|
if m.poster.height > posterVertSpace
|
|
|
|
' Do a thing to shrink the image if it is too tall
|
|
|
|
end if
|
|
|
|
|
|
|
|
m.poster.translation = [2, (posterVertSpace - m.poster.height) / 2]
|
2019-05-03 12:48:59 +00:00
|
|
|
|
|
|
|
m.backdrop.width = m.poster.width
|
|
|
|
m.backdrop.height = m.poster.height
|
|
|
|
|
|
|
|
end sub
|
|
|
|
|
|
|
|
function itemContentChanged() as void
|
|
|
|
|
|
|
|
m.title = m.top.findNode("title")
|
|
|
|
m.poster = m.top.findNode("poster")
|
|
|
|
itemData = m.top.itemContent
|
|
|
|
m.title.text = itemData.title
|
2020-04-29 07:40:12 +00:00
|
|
|
if itemData.json.lookup("Type") = "Episode" and itemData.json.IndexNumber <> invalid
|
2019-07-23 03:11:13 +00:00
|
|
|
m.title.text = StrI(itemData.json.IndexNumber) + ". " + m.title.text
|
|
|
|
end if
|
2019-05-03 12:48:59 +00:00
|
|
|
m.poster.uri = itemData.posterUrl
|
|
|
|
|
2019-05-10 04:24:19 +00:00
|
|
|
updateSize()
|
2019-07-23 03:11:13 +00:00
|
|
|
end function
|