Merge pull request #81 from bisby/bisby/issue-78
Turn library list to a single row and simplify things
This commit is contained in:
commit
0e76882ac3
|
@ -2,10 +2,12 @@ sub init()
|
|||
m.top.itemComponentName = "LibItem"
|
||||
m.top.content = getData()
|
||||
|
||||
m.top.rowFocusAnimationStyle = "floatingFocus"
|
||||
m.top.vertFocusAnimationStyle = "floatingFocus"
|
||||
m.top.rowFocusAnimationStyle = "fixedFocusWrap"
|
||||
m.top.vertFocusAnimationStyle = "fixedFocusWrap"
|
||||
|
||||
m.top.showRowLabel = [false]
|
||||
m.top.showRowLabel = [ true ]
|
||||
m.top.rowLabelOffset = [0, 20]
|
||||
m.top.showRowCounter = [ true ]
|
||||
|
||||
updateSize()
|
||||
|
||||
|
@ -13,21 +15,21 @@ sub init()
|
|||
end sub
|
||||
|
||||
sub updateSize()
|
||||
m.top.numrows = 1
|
||||
m.top.rowSize = 5
|
||||
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
|
||||
border = 200
|
||||
' 115 is the overhand height
|
||||
m.top.translation = [border, border + 115]
|
||||
|
||||
itemWidth = (dimensions["width"] - border*2) / m.top.rowSize
|
||||
itemHeight = itemWidth / 2
|
||||
itemWidth = 300
|
||||
itemHeight = 100
|
||||
|
||||
m.top.visible = true
|
||||
|
||||
' size of the whole row
|
||||
m.top.itemSize = [dimensions["width"] - border*2, itemHeight]
|
||||
m.top.itemSize = [1920 - border * 2, itemHeight]
|
||||
' spacing between rows
|
||||
m.top.itemSpacing = [ 0, 30 ]
|
||||
|
||||
|
@ -37,48 +39,30 @@ sub updateSize()
|
|||
m.top.rowItemSpacing = [ 0, 0 ]
|
||||
end sub
|
||||
|
||||
function setData()
|
||||
libs = m.top.liblist
|
||||
rowsize = m.top.rowSize
|
||||
|
||||
n = libs.TotalRecordCount
|
||||
|
||||
' 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.libList = invalid then
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
m.top.content = data
|
||||
return data
|
||||
end if
|
||||
|
||||
libs = m.top.libList
|
||||
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
|
||||
if index > libs.TotalRecordCount then
|
||||
exit for
|
||||
end if
|
||||
item = libs.Items[index-1]
|
||||
row.title = "Libraries" ' TODO - make this tweakable?
|
||||
for i=1 to libs.TotalRecordCount
|
||||
item = libs.Items[i-1]
|
||||
row.appendChild(item)
|
||||
end for
|
||||
end for
|
||||
m.top.content = data
|
||||
return data
|
||||
end function
|
||||
|
||||
function onKeyEvent(key as string, press as boolean) as boolean
|
||||
if not press then return false
|
||||
|
||||
' When hitting down, if unhandled then we are trying to escape downwards
|
||||
if key = "down" and (m.top.itemFocused + 1) = m.top.content.getChildCount()
|
||||
search = m.top.getScene().findNode("search")
|
||||
search.setFocus(true)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<component name="LibraryRow" extends="RowList">
|
||||
<interface>
|
||||
<field id="rowSize" type="int" />
|
||||
<field id="libList" type="associativearray" onChange="setData" />
|
||||
<field id="libList" type="associativearray" onChange="getData" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="rowlist.brs"/>
|
||||
</component>
|
||||
|
|
Loading…
Reference in New Issue
Block a user