2019-03-05 04:31:58 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8" ?>
|
|
|
|
<component name="MovieRow" extends="RowList">
|
|
|
|
<interface>
|
2019-03-05 05:18:01 +00:00
|
|
|
<field id="rowSize" type="int" />
|
|
|
|
<field id="movieData" type="associativearray" onChange="setData" />
|
2019-03-12 23:34:51 +00:00
|
|
|
<field id="library" type="associativearray" />
|
2019-03-05 04:31:58 +00:00
|
|
|
</interface>
|
|
|
|
<script type="text/brightscript">
|
|
|
|
<![CDATA[
|
|
|
|
sub init()
|
2019-03-11 16:59:15 +00:00
|
|
|
m.top.itemComponentName = "ListPoster"
|
2019-03-05 04:31:58 +00:00
|
|
|
m.top.content = getData()
|
|
|
|
|
2019-03-10 05:53:36 +00:00
|
|
|
m.top.rowFocusAnimationStyle = "floatingFocus"
|
|
|
|
'm.top.vertFocusAnimationStyle = "floatingFocus"
|
|
|
|
|
|
|
|
m.top.showRowLabel = [false]
|
|
|
|
|
|
|
|
updateSize()
|
|
|
|
|
|
|
|
m.top.setfocus(true)
|
|
|
|
end sub
|
|
|
|
|
|
|
|
sub updateSize()
|
2019-03-05 04:31:58 +00:00
|
|
|
m.top.numrows = 1
|
2019-03-09 20:08:34 +00:00
|
|
|
m.top.rowSize = 5
|
|
|
|
|
|
|
|
dimensions = m.top.getScene().currentDesignResolution
|
|
|
|
|
|
|
|
border = 75
|
2019-03-12 23:34:51 +00:00
|
|
|
m.top.translation = [border, border + 115]
|
2019-03-09 20:08:34 +00:00
|
|
|
|
|
|
|
textHeight = 50
|
|
|
|
' Do we decide width by rowSize, or rowSize by width...
|
|
|
|
itemWidth = (dimensions["width"] - border*2) / m.top.rowSize
|
|
|
|
itemHeight = itemWidth * 1.5 + textHeight
|
2019-03-05 04:31:58 +00:00
|
|
|
|
|
|
|
m.top.visible = true
|
2019-03-09 20:08:34 +00:00
|
|
|
|
|
|
|
' size of the whole row
|
|
|
|
m.top.itemSize = [dimensions["width"] - border*2, itemHeight]
|
|
|
|
' spacing between rows
|
|
|
|
m.top.itemSpacing = [ 0, 10 ]
|
|
|
|
|
|
|
|
' size of the item in the row
|
|
|
|
m.top.rowItemSize = [ itemWidth, itemHeight ]
|
|
|
|
' spacing between items in a row
|
|
|
|
m.top.rowItemSpacing = [ 0, 0 ]
|
2019-03-05 04:31:58 +00:00
|
|
|
end sub
|
|
|
|
|
|
|
|
function setData()
|
2019-03-08 02:03:19 +00:00
|
|
|
movieData = m.top.movieData
|
2019-03-05 04:31:58 +00:00
|
|
|
rowsize = m.top.rowSize
|
|
|
|
|
2019-03-08 02:03:19 +00:00
|
|
|
n = movieData.items.count()
|
2019-03-05 04:31:58 +00:00
|
|
|
|
|
|
|
' Test for no remainder
|
|
|
|
if int(n/rowsize) = n/rowsize then
|
|
|
|
m.top.numRows = n/rowsize
|
|
|
|
else
|
|
|
|
m.top.numRows = n/rowsize + 1
|
|
|
|
end if
|
|
|
|
|
|
|
|
m.top.content = getData()
|
|
|
|
end function
|
|
|
|
|
|
|
|
function getData()
|
|
|
|
if m.top.movieData = invalid then
|
|
|
|
data = CreateObject("roSGNode", "ContentNode")
|
|
|
|
return data
|
|
|
|
end if
|
|
|
|
|
2019-03-08 02:03:19 +00:00
|
|
|
movieData = m.top.movieData
|
2019-03-05 04:31:58 +00:00
|
|
|
rowsize = m.top.rowSize
|
|
|
|
data = CreateObject("roSGNode", "ContentNode")
|
|
|
|
for rownum=1 to m.top.numRows
|
|
|
|
row = data.CreateChild("ContentNode")
|
|
|
|
for i=1 to rowsize
|
|
|
|
index = (rownum - 1) * rowsize + i
|
2019-03-08 02:03:19 +00:00
|
|
|
if index > movieData.items.count() then
|
2019-03-05 04:31:58 +00:00
|
|
|
exit for
|
|
|
|
end if
|
2019-03-08 02:03:19 +00:00
|
|
|
datum = movieData.Items[index-1]
|
2019-03-12 01:24:39 +00:00
|
|
|
item = row.CreateChild("MovieData")
|
2019-03-08 02:03:19 +00:00
|
|
|
item.full_data = datum
|
2019-03-05 04:31:58 +00:00
|
|
|
end for
|
|
|
|
end for
|
|
|
|
return data
|
|
|
|
end function
|
2019-03-12 03:49:17 +00:00
|
|
|
|
|
|
|
function onKeyEvent(key as string, press as boolean) as boolean
|
|
|
|
if not press then return false
|
|
|
|
|
|
|
|
if key = "down" and (m.top.itemFocused + 1) = m.top.content.getChildCount()
|
|
|
|
m.top.getScene().findNode("pager").setFocus(true)
|
|
|
|
m.top.getScene().findNode("pager").getChild(0).setFocus(true)
|
|
|
|
return true
|
|
|
|
end if
|
|
|
|
|
|
|
|
return false
|
|
|
|
end function
|
2019-03-05 04:31:58 +00:00
|
|
|
]]>
|
|
|
|
</script>
|
|
|
|
</component>
|