jf-roku/components/ListPoster.xml

56 lines
1.3 KiB
XML
Raw Normal View History

2019-03-11 02:35:48 +00:00
<?xml version="1.0" encoding="utf-8" ?>
<component name="ListPoster" extends="Group">
2019-03-11 02:35:48 +00:00
<children>
<Poster id="poster"
translation="[2, 0]"
/>
<Label id="title"
horizAlign="center"
font="font:SmallSystemFont"
/>
</children>
<interface>
<field id="itemContent" type="node" onChange="itemContentChanged"/>
<field id="itemWidth" type="integer" />
2019-03-11 02:35:48 +00:00
</interface>
<script type="text/brightscript">
<![CDATA[
sub init()
m.title = m.top.findNode("title")
m.poster = m.top.findNode("poster")
updateSize()
end sub
sub updateSize()
m.title = m.top.findNode("title")
m.poster = m.top.findNode("poster")
' TODO - abstract this in case the parent doesnt have itemSize
2019-03-11 02:35:48 +00:00
maxSize = m.top.getParent().itemSize
m.poster.width = int(maxSize[0]) - 4
m.poster.height = m.poster.width * 1.5
m.title.width = m.poster.width
m.title.height = int(maxSize[1]) - m.poster.height
m.title.translation = [0, m.poster.height]
2019-03-11 02:35:48 +00:00
end sub
function itemContentChanged() as void
updateSize()
m.title = m.top.findNode("title")
m.poster = m.top.findNode("poster")
itemData = m.top.itemContent
2019-03-11 02:35:48 +00:00
m.title.text = itemData.title
m.poster.uri = itemData.posterUrl
end function
]]>
</script>
</component>