Clean up TV show seasons display a bit better

This commit is contained in:
Nick Bisby 2019-03-17 00:47:31 -05:00
parent 95fd91fb70
commit 8c4be5b3b9
No known key found for this signature in database
GPG Key ID: F6E0C4E6D0B5EB36
2 changed files with 16 additions and 33 deletions

View File

@ -26,7 +26,7 @@
</LayoutGroup> </LayoutGroup>
</LayoutGroup> </LayoutGroup>
<!-- Next Up --> <!-- Next Up -->
<TVSeasonRow id="TVSeasonSelect" visible="true" translation="[150, 800]" /> <TVSeasonRow id="TVSeasonSelect" visible="true" />
</children> </children>
<interface> <interface>
<field id="itemContent" type="node" onChange="itemContentChanged" /> <field id="itemContent" type="node" onChange="itemContentChanged" />
@ -36,9 +36,12 @@
<![CDATA[ <![CDATA[
sub init() sub init()
main = m.top.findNode("main_group") main = m.top.findNode("main_group")
seasons = m.top.findNode("TVSeasonSelect")
dimensions = m.top.getScene().currentDesignResolution dimensions = m.top.getScene().currentDesignResolution
main.translation=[50, 50] main.translation = [50, 50]
' TODO - validate this height against the height of main
seasons.translation = [50, 800]
m.top.findNode("buttons").setFocus(true) m.top.findNode("buttons").setFocus(true)
end sub end sub

View File

@ -2,7 +2,7 @@
<component name="TVSeasonRow" extends="RowList"> <component name="TVSeasonRow" extends="RowList">
<interface> <interface>
<field id="rowSize" type="int" /> <field id="rowSize" type="int" />
<field id="TVSeasonData" type="associativearray" onChange="setData" /> <field id="TVSeasonData" type="associativearray" onChange="getData" />
</interface> </interface>
<script type="text/brightscript"> <script type="text/brightscript">
<![CDATA[ <![CDATA[
@ -14,7 +14,8 @@
'm.top.rowFocusAnimationStyle = "floatingFocus" 'm.top.rowFocusAnimationStyle = "floatingFocus"
'm.top.vertFocusAnimationStyle = "floatingFocus" 'm.top.vertFocusAnimationStyle = "floatingFocus"
m.top.showRowLabel = [false] m.top.showRowLabel = [true]
m.top.rowLabelOffset = [0, 20]
updateSize() updateSize()
@ -22,12 +23,12 @@
end sub end sub
sub updateSize() sub updateSize()
m.top.numrows = 1 ' Infinite scroll, rowsize is just how many show on screen at once
m.top.rowSize = 5 m.top.rowSize = 5
dimensions = m.top.getScene().currentDesignResolution dimensions = m.top.getScene().currentDesignResolution
border = 75 border = 50
m.top.translation = [border, border] m.top.translation = [border, border]
textHeight = 50 textHeight = 50
@ -48,22 +49,6 @@
m.top.rowItemSpacing = [ 0, 0 ] m.top.rowItemSpacing = [ 0, 0 ]
end sub end sub
function setData()
seasonData = m.top.TVSeasonData
rowsize = m.top.rowSize
n = seasonData.items.count()
' 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() function getData()
if m.top.TVSeasonData = invalid then if m.top.TVSeasonData = invalid then
data = CreateObject("roSGNode", "ContentNode") data = CreateObject("roSGNode", "ContentNode")
@ -73,18 +58,13 @@
seasonData = m.top.TVSeasonData seasonData = m.top.TVSeasonData
rowsize = m.top.rowSize rowsize = m.top.rowSize
data = CreateObject("roSGNode", "ContentNode") data = CreateObject("roSGNode", "ContentNode")
for rownum=1 to m.top.numRows row = data.CreateChild("ContentNode")
row = data.CreateChild("ContentNode") row.title = "Seasons"
for i=1 to rowsize for each datum in seasonData.items
index = (rownum - 1) * rowsize + i item = row.CreateChild("TVSeasonData")
if index > seasonData.items.count() then item.full_data = datum
exit for
end if
datum = seasonData.Items[index-1]
item = row.CreateChild("TVSeasonData")
item.full_data = datum
end for
end for end for
m.top.content = data
return data return data
end function end function
]]> ]]>