Splitting brs from inline XML
This commit is contained in:
parent
77a0dd139d
commit
531e668358
25
components/ButtonGroupHoriz.brs
Normal file
25
components/ButtonGroupHoriz.brs
Normal file
|
@ -0,0 +1,25 @@
|
|||
sub init()
|
||||
m.top.layoutDirection = "horiz"
|
||||
end sub
|
||||
|
||||
function onKeyEvent(key as string, press as boolean) as boolean
|
||||
if not press then return false
|
||||
if key = "right"
|
||||
i = m.top.buttonFocused
|
||||
target = i + 1
|
||||
if target >= m.top.getChildCount() then return false
|
||||
m.top.focusButton = target
|
||||
return true
|
||||
else if key = "left"
|
||||
i = m.top.buttonFocused
|
||||
target = i - 1
|
||||
if target < 0 then return false
|
||||
m.top.focusButton = target
|
||||
return true
|
||||
else if key = "up" or key = "down"
|
||||
m.top.escape = true
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
|
@ -3,35 +3,7 @@
|
|||
<interface>
|
||||
<field id="escape" type="boolean" alwaysNotify="true" />
|
||||
</interface>
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
m.top.layoutDirection = "horiz"
|
||||
end sub
|
||||
|
||||
function onKeyEvent(key as string, press as boolean) as boolean
|
||||
if not press then return false
|
||||
if key = "right"
|
||||
i = m.top.buttonFocused
|
||||
target = i + 1
|
||||
if target >= m.top.getChildCount() then return false
|
||||
m.top.focusButton = target
|
||||
return true
|
||||
else if key = "left"
|
||||
i = m.top.buttonFocused
|
||||
target = i - 1
|
||||
if target < 0 then return false
|
||||
m.top.focusButton = target
|
||||
return true
|
||||
else if key = "up" or key = "down"
|
||||
m.top.escape = true
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="ButtonGroupHoriz.brs" />
|
||||
|
||||
|
||||
</component>
|
||||
|
|
47
components/ListPoster.brs
Normal file
47
components/ListPoster.brs
Normal file
|
@ -0,0 +1,47 @@
|
|||
sub init()
|
||||
m.title = m.top.findNode("title")
|
||||
m.poster = m.top.findNode("poster")
|
||||
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")
|
||||
|
||||
' TODO - abstract this in case the parent doesnt have itemSize
|
||||
maxSize = m.top.getParent().itemSize
|
||||
|
||||
m.poster.width = int(maxSize[0]) - 4
|
||||
m.poster.height = m.poster.width * 1.5
|
||||
|
||||
m.backdrop.width = m.poster.width
|
||||
m.backdrop.height = m.poster.height
|
||||
|
||||
m.title.wrap = true
|
||||
m.title.maxLines = 2
|
||||
m.title.width = m.poster.width
|
||||
m.title.height = int(maxSize[1]) - m.poster.height
|
||||
m.title.translation = [0, m.poster.height]
|
||||
|
||||
end sub
|
||||
|
||||
function itemContentChanged() as void
|
||||
updateSize()
|
||||
|
||||
m.title = m.top.findNode("title")
|
||||
m.poster = m.top.findNode("poster")
|
||||
itemData = m.top.itemContent
|
||||
|
||||
m.title.text = itemData.title
|
||||
m.poster.uri = itemData.posterUrl
|
||||
|
||||
if itemData.mediaType = "Episode"
|
||||
m.poster.height = m.poster.width * 9/16
|
||||
m.poster.translation = [2, m.poster.width / 2]
|
||||
end if
|
||||
end function
|
|
@ -18,56 +18,6 @@
|
|||
<!-- mediatype -->
|
||||
</interface>
|
||||
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
m.title = m.top.findNode("title")
|
||||
m.poster = m.top.findNode("poster")
|
||||
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")
|
||||
|
||||
' TODO - abstract this in case the parent doesnt have itemSize
|
||||
maxSize = m.top.getParent().itemSize
|
||||
|
||||
m.poster.width = int(maxSize[0]) - 4
|
||||
m.poster.height = m.poster.width * 1.5
|
||||
|
||||
m.backdrop.width = m.poster.width
|
||||
m.backdrop.height = m.poster.height
|
||||
|
||||
m.title.wrap = true
|
||||
m.title.maxLines = 2
|
||||
m.title.width = m.poster.width
|
||||
m.title.height = int(maxSize[1]) - m.poster.height
|
||||
m.title.translation = [0, m.poster.height]
|
||||
|
||||
end sub
|
||||
|
||||
function itemContentChanged() as void
|
||||
updateSize()
|
||||
|
||||
m.title = m.top.findNode("title")
|
||||
m.poster = m.top.findNode("poster")
|
||||
itemData = m.top.itemContent
|
||||
|
||||
m.title.text = itemData.title
|
||||
m.poster.uri = itemData.posterUrl
|
||||
|
||||
if itemData.mediaType = "Episode"
|
||||
m.poster.height = m.poster.width * 9/16
|
||||
m.poster.translation = [2, m.poster.width / 2]
|
||||
end if
|
||||
end function
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="ListPoster.brs" />
|
||||
|
||||
</component>
|
||||
|
|
112
components/Pager.brs
Normal file
112
components/Pager.brs
Normal file
|
@ -0,0 +1,112 @@
|
|||
sub init()
|
||||
m.top.currentPage = 0
|
||||
m.top.maxPages = 0
|
||||
m.top.layoutDirection = "horiz"
|
||||
m.top.horizAlignment = "center"
|
||||
m.top.vertAlignment = "center"
|
||||
end sub
|
||||
|
||||
sub recountPages()
|
||||
if m.top.currentPage = 0 or m.top.maxPages = 0
|
||||
return
|
||||
end if
|
||||
while m.top.getChildCount() > 0
|
||||
m.top.removeChildIndex(0)
|
||||
end while
|
||||
|
||||
currentPage = m.top.currentPage
|
||||
maxPages = m.top.maxPages
|
||||
|
||||
minShown = 1
|
||||
maxShown = maxPages
|
||||
|
||||
if currentPage > 1
|
||||
addPage("<")
|
||||
minShown = currentPage - 3
|
||||
end if
|
||||
|
||||
if minShown <= 0 then minShown = 1
|
||||
|
||||
if currentPage < maxPages then maxShown = currentPage + 3
|
||||
if maxShown >= maxPages then maxShown = maxPages
|
||||
|
||||
for i=minShown to maxShown step 1
|
||||
addPage(i)
|
||||
end for
|
||||
|
||||
if currentPage <> maxPages
|
||||
addPage(">")
|
||||
end if
|
||||
|
||||
m.top.pageFocused = m.top.findNode(stri(currentPage).trim())
|
||||
|
||||
m.top.pageFocused.color = "#00ff00ff"
|
||||
|
||||
updateLayout()
|
||||
end sub
|
||||
|
||||
sub updateLayout()
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
height = 115
|
||||
m.top.translation = [dimensions.width / 2, dimensions.height - (height / 2)]
|
||||
end sub
|
||||
|
||||
sub addPage(i)
|
||||
p = CreateObject("roSGNode", "Label")
|
||||
p.height = 50
|
||||
p.width = 50
|
||||
p.color = "#a1a1a1FF"
|
||||
if type(i) = "roInt"
|
||||
i = stri(i).trim()
|
||||
end if
|
||||
p.id = i
|
||||
p.text = i
|
||||
m.top.appendChild(p)
|
||||
end sub
|
||||
|
||||
function onKeyEvent(key as string, press as boolean) as boolean
|
||||
if not press then return false
|
||||
|
||||
if key = "OK"
|
||||
m.top.pageSelected = m.top.focusedChild
|
||||
return true
|
||||
else if key = "left"
|
||||
focusPrev()
|
||||
return true
|
||||
else if key = "right"
|
||||
focusNext()
|
||||
return true
|
||||
else if key = "up"
|
||||
m.top.escape = true
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
||||
|
||||
sub focusNext()
|
||||
i = getFocusIndex()
|
||||
if (i + 1) = m.top.getChildCount() then return
|
||||
|
||||
m.top.pageFocused.color = "#a1a1a1FF"
|
||||
m.top.pageFocused = m.top.getChild(i + 1)
|
||||
m.top.pageFocused.color = "#00ff00ff"
|
||||
m.top.pageFocused.setFocus(true)
|
||||
end sub
|
||||
|
||||
sub focusPrev()
|
||||
i = getFocusIndex()
|
||||
if i = 0 then return
|
||||
|
||||
m.top.pageFocused.color = "#a1a1a1FF"
|
||||
m.top.pageFocused = m.top.getChild(i - 1)
|
||||
m.top.pageFocused.color = "#00ff00ff"
|
||||
m.top.pageFocused.setFocus(true)
|
||||
end sub
|
||||
|
||||
function getFocusIndex()
|
||||
for i=0 to m.top.getChildCount() step 1
|
||||
if m.top.getChild(i).id = m.top.pageFocused.id then return i
|
||||
end for
|
||||
return invalid
|
||||
end function
|
|
@ -7,120 +7,5 @@
|
|||
<field id="pageSelected" type="node" />
|
||||
<field id="escape" type="boolean" alwaysNotify="true" />
|
||||
</interface>
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
m.top.currentPage = 0
|
||||
m.top.maxPages = 0
|
||||
m.top.layoutDirection = "horiz"
|
||||
m.top.horizAlignment = "center"
|
||||
m.top.vertAlignment = "center"
|
||||
end sub
|
||||
|
||||
sub recountPages()
|
||||
if m.top.currentPage = 0 or m.top.maxPages = 0
|
||||
return
|
||||
end if
|
||||
while m.top.getChildCount() > 0
|
||||
m.top.removeChildIndex(0)
|
||||
end while
|
||||
|
||||
currentPage = m.top.currentPage
|
||||
maxPages = m.top.maxPages
|
||||
|
||||
minShown = 1
|
||||
maxShown = maxPages
|
||||
|
||||
if currentPage > 1
|
||||
addPage("<")
|
||||
minShown = currentPage - 3
|
||||
end if
|
||||
|
||||
if minShown <= 0 then minShown = 1
|
||||
|
||||
if currentPage < maxPages then maxShown = currentPage + 3
|
||||
if maxShown >= maxPages then maxShown = maxPages
|
||||
|
||||
for i=minShown to maxShown step 1
|
||||
addPage(i)
|
||||
end for
|
||||
|
||||
if currentPage <> maxPages
|
||||
addPage(">")
|
||||
end if
|
||||
|
||||
m.top.pageFocused = m.top.findNode(stri(currentPage).trim())
|
||||
|
||||
m.top.pageFocused.color = "#00ff00ff"
|
||||
|
||||
updateLayout()
|
||||
end sub
|
||||
|
||||
sub updateLayout()
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
height = 115
|
||||
m.top.translation = [dimensions.width / 2, dimensions.height - (height / 2)]
|
||||
end sub
|
||||
|
||||
sub addPage(i)
|
||||
p = CreateObject("roSGNode", "Label")
|
||||
p.height = 50
|
||||
p.width = 50
|
||||
p.color = "#a1a1a1FF"
|
||||
if type(i) = "roInt"
|
||||
i = stri(i).trim()
|
||||
end if
|
||||
p.id = i
|
||||
p.text = i
|
||||
m.top.appendChild(p)
|
||||
end sub
|
||||
|
||||
function onKeyEvent(key as string, press as boolean) as boolean
|
||||
if not press then return false
|
||||
|
||||
if key = "OK"
|
||||
m.top.pageSelected = m.top.focusedChild
|
||||
return true
|
||||
else if key = "left"
|
||||
focusPrev()
|
||||
return true
|
||||
else if key = "right"
|
||||
focusNext()
|
||||
return true
|
||||
else if key = "up"
|
||||
m.top.escape = true
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
||||
|
||||
sub focusNext()
|
||||
i = getFocusIndex()
|
||||
if (i + 1) = m.top.getChildCount() then return
|
||||
|
||||
m.top.pageFocused.color = "#a1a1a1FF"
|
||||
m.top.pageFocused = m.top.getChild(i + 1)
|
||||
m.top.pageFocused.color = "#00ff00ff"
|
||||
m.top.pageFocused.setFocus(true)
|
||||
end sub
|
||||
|
||||
sub focusPrev()
|
||||
i = getFocusIndex()
|
||||
if i = 0 then return
|
||||
|
||||
m.top.pageFocused.color = "#a1a1a1FF"
|
||||
m.top.pageFocused = m.top.getChild(i - 1)
|
||||
m.top.pageFocused.color = "#00ff00ff"
|
||||
m.top.pageFocused.setFocus(true)
|
||||
end sub
|
||||
|
||||
function getFocusIndex()
|
||||
for i=0 to m.top.getChildCount() step 1
|
||||
if m.top.getChild(i).id = m.top.pageFocused.id then return i
|
||||
end for
|
||||
return invalid
|
||||
end function
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="Pager.brs" />
|
||||
</component>
|
||||
|
|
54
components/SearchBox.brs
Normal file
54
components/SearchBox.brs
Normal file
|
@ -0,0 +1,54 @@
|
|||
sub init()
|
||||
m.top.layoutDirection = "vert"
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
m.top.translation = [dimensions.width / 2, 880]
|
||||
m.top.horizAlignment = "center"
|
||||
m.top.vertAlignment = "top"
|
||||
end sub
|
||||
|
||||
function onKeyEvent(key as string, press as boolean) as boolean
|
||||
if not press then return false
|
||||
|
||||
if key = "OK"
|
||||
' Make a Keyboard Dialog here
|
||||
show_dialog()
|
||||
return true
|
||||
else if key = "up"
|
||||
m.top.findNode("search-input").active = false
|
||||
m.top.escape = true
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
||||
|
||||
function onDialogButton()
|
||||
d = m.top.getScene().dialog
|
||||
button_text = d.buttons[d.buttonSelected]
|
||||
|
||||
if button_text = "Search"
|
||||
m.top.search_value = d.text
|
||||
dismiss_dialog()
|
||||
return true
|
||||
else if button_text = "Cancel"
|
||||
dismiss_dialog()
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
||||
|
||||
sub show_dialog()
|
||||
dialog = CreateObject("roSGNode", "KeyboardDialog")
|
||||
dialog.title = "Search"
|
||||
dialog.buttons = ["Search", "Cancel"]
|
||||
|
||||
m.top.getScene().dialog = dialog
|
||||
|
||||
dialog.observeField("buttonselected", "onDialogButton")
|
||||
end sub
|
||||
|
||||
sub dismiss_dialog()
|
||||
m.top.getScene().dialog.close = true
|
||||
|
||||
end sub
|
|
@ -8,62 +8,5 @@
|
|||
<field id="escape" type="boolean" alwaysNotify="true" />
|
||||
<field id="search_value" type="string" alwaysNotify="true" />
|
||||
</interface>
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
m.top.layoutDirection = "vert"
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
m.top.translation = [dimensions.width / 2, 880]
|
||||
m.top.horizAlignment = "center"
|
||||
m.top.vertAlignment = "top"
|
||||
end sub
|
||||
|
||||
function onKeyEvent(key as string, press as boolean) as boolean
|
||||
if not press then return false
|
||||
|
||||
if key = "OK"
|
||||
' Make a Keyboard Dialog here
|
||||
show_dialog()
|
||||
return true
|
||||
else if key = "up"
|
||||
m.top.findNode("search-input").active = false
|
||||
m.top.escape = true
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
||||
|
||||
function onDialogButton()
|
||||
d = m.top.getScene().dialog
|
||||
button_text = d.buttons[d.buttonSelected]
|
||||
|
||||
if button_text = "Search"
|
||||
m.top.search_value = d.text
|
||||
dismiss_dialog()
|
||||
return true
|
||||
else if button_text = "Cancel"
|
||||
dismiss_dialog()
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
||||
|
||||
sub show_dialog()
|
||||
dialog = CreateObject("roSGNode", "KeyboardDialog")
|
||||
dialog.title = "Search"
|
||||
dialog.buttons = ["Search", "Cancel"]
|
||||
|
||||
m.top.getScene().dialog = dialog
|
||||
|
||||
dialog.observeField("buttonselected", "onDialogButton")
|
||||
end sub
|
||||
|
||||
sub dismiss_dialog()
|
||||
m.top.getScene().dialog.close = true
|
||||
|
||||
end sub
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="SearchBox.brs" />
|
||||
</component>
|
||||
|
|
|
@ -1,5 +1,14 @@
|
|||
sub init()
|
||||
main = m.top.findNode("main_group")
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
|
||||
main.translation=[50, 50]
|
||||
|
||||
m.top.findNode("buttons").setFocus(true)
|
||||
end sub
|
||||
|
||||
sub itemContentChanged()
|
||||
' Updates video metadata
|
||||
' Updates video metadata
|
||||
item = m.top.itemContent
|
||||
itemData = item.json
|
||||
|
||||
|
@ -45,7 +54,7 @@ sub setFieldText(field as string, value)
|
|||
node.text = value
|
||||
end sub
|
||||
|
||||
function getRuntime() as Integer
|
||||
function getRuntime() as integer
|
||||
itemData = m.top.itemContent.json
|
||||
|
||||
' A tick is .1ms, so 1/10,000,000 for ticks to seconds,
|
||||
|
@ -100,7 +109,7 @@ sub setWatchedColor()
|
|||
end if
|
||||
end sub
|
||||
|
||||
function round(f as Float) as Integer
|
||||
function round(f as float) as integer
|
||||
' BrightScript only has a "floor" round
|
||||
' This compares floor to floor + 1 to find which is closer
|
||||
m = int(f)
|
||||
|
|
|
@ -33,17 +33,5 @@
|
|||
<field id="itemContent" type="node" onChange="itemContentChanged" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/misc.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/components/collections/details.brs" />
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
main = m.top.findNode("main_group")
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
|
||||
main.translation=[50, 50]
|
||||
|
||||
m.top.findNode("buttons").setFocus(true)
|
||||
end sub
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="details.brs" />
|
||||
</component>
|
||||
|
|
13
components/collections/minimal-details.brs
Normal file
13
components/collections/minimal-details.brs
Normal file
|
@ -0,0 +1,13 @@
|
|||
sub Init()
|
||||
m.title = m.top.findNode("title")
|
||||
m.title.text = "Loading..."
|
||||
end sub
|
||||
|
||||
function itemContentChanged() as void
|
||||
' re-declare this because init doesnt re-run
|
||||
' when we come back from elsewhere
|
||||
m.title = m.top.findNode("title")
|
||||
|
||||
itemData = m.top.itemContent
|
||||
m.title.text = itemData.title
|
||||
end function
|
|
@ -11,23 +11,5 @@
|
|||
<interface>
|
||||
<field id="itemContent" type="node" onChange="itemContentChanged"/>
|
||||
</interface>
|
||||
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub Init()
|
||||
m.title = m.top.findNode("title")
|
||||
m.title.text = "Loading..."
|
||||
end sub
|
||||
|
||||
function itemContentChanged() as void
|
||||
' re-declare this because init doesnt re-run
|
||||
' when we come back from elsewhere
|
||||
m.title = m.top.findNode("title")
|
||||
|
||||
itemData = m.top.itemContent
|
||||
m.title.text = itemData.title
|
||||
end function
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<script type="text/brightscript" uri="minimal-details.brs"/>
|
||||
</component>
|
||||
|
|
99
components/collections/rowlist.brs
Normal file
99
components/collections/rowlist.brs
Normal file
|
@ -0,0 +1,99 @@
|
|||
sub init()
|
||||
m.top.itemComponentName = "ListPoster"
|
||||
m.top.content = getData()
|
||||
|
||||
m.top.rowFocusAnimationStyle = "floatingFocus"
|
||||
'm.top.vertFocusAnimationStyle = "floatingFocus"
|
||||
|
||||
m.top.showRowLabel = [false]
|
||||
|
||||
updateSize()
|
||||
|
||||
m.top.setfocus(true)
|
||||
end sub
|
||||
|
||||
sub updateSize()
|
||||
m.top.numrows = 1
|
||||
m.top.rowSize = 5
|
||||
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
|
||||
border = 75
|
||||
m.top.translation = [border, border + 115]
|
||||
|
||||
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
|
||||
|
||||
m.top.visible = true
|
||||
|
||||
' 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 ]
|
||||
end sub
|
||||
|
||||
function setData()
|
||||
itemData = m.top.itemData
|
||||
rowsize = m.top.rowSize
|
||||
|
||||
n = itemData.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()
|
||||
if m.top.itemData = invalid then
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
return data
|
||||
end if
|
||||
|
||||
itemData = m.top.itemData
|
||||
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 > itemData.items.count() then
|
||||
exit for
|
||||
end if
|
||||
item = itemData.Items[index-1]
|
||||
row.appendChild(item)
|
||||
end for
|
||||
end for
|
||||
return data
|
||||
end function
|
||||
|
||||
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
|
||||
else if key = "options"
|
||||
options = m.top.getScene().findNode("options")
|
||||
list = options.findNode("panelList")
|
||||
|
||||
options.visible = true
|
||||
list.setFocus(true)
|
||||
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
|
@ -5,107 +5,5 @@
|
|||
<field id="itemData" type="associativearray" onChange="setData" />
|
||||
<field id="library" type="associativearray" />
|
||||
</interface>
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
m.top.itemComponentName = "ListPoster"
|
||||
m.top.content = getData()
|
||||
|
||||
m.top.rowFocusAnimationStyle = "floatingFocus"
|
||||
'm.top.vertFocusAnimationStyle = "floatingFocus"
|
||||
|
||||
m.top.showRowLabel = [false]
|
||||
|
||||
updateSize()
|
||||
|
||||
m.top.setfocus(true)
|
||||
end sub
|
||||
|
||||
sub updateSize()
|
||||
m.top.numrows = 1
|
||||
m.top.rowSize = 5
|
||||
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
|
||||
border = 75
|
||||
m.top.translation = [border, border + 115]
|
||||
|
||||
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
|
||||
|
||||
m.top.visible = true
|
||||
|
||||
' 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 ]
|
||||
end sub
|
||||
|
||||
function setData()
|
||||
itemData = m.top.itemData
|
||||
rowsize = m.top.rowSize
|
||||
|
||||
n = itemData.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()
|
||||
if m.top.itemData = invalid then
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
return data
|
||||
end if
|
||||
|
||||
itemData = m.top.itemData
|
||||
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 > itemData.items.count() then
|
||||
exit for
|
||||
end if
|
||||
item = itemData.Items[index-1]
|
||||
row.appendChild(item)
|
||||
end for
|
||||
end for
|
||||
return data
|
||||
end function
|
||||
|
||||
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
|
||||
else if key = "options"
|
||||
options = m.top.getScene().findNode("options")
|
||||
list = options.findNode("panelList")
|
||||
|
||||
options.visible = true
|
||||
list.setFocus(true)
|
||||
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="rowlist.brs"/>
|
||||
</component>
|
||||
|
|
43
components/config/item.brs
Normal file
43
components/config/item.brs
Normal file
|
@ -0,0 +1,43 @@
|
|||
sub init()
|
||||
m.name = m.top.findNode("label")
|
||||
m.value = m.top.findNode("value")
|
||||
|
||||
m.top.layoutDirection = "horiz"
|
||||
m.top.vertAlignment = "top"
|
||||
|
||||
m.name.width = 250
|
||||
m.name.height = 80
|
||||
|
||||
m.name.vertAlign = "center"
|
||||
m.name.horizAlign = "center"
|
||||
|
||||
' TODO - calculate "width" better... this is total item - (label + spacings)
|
||||
m.value.width = 1000 - 230
|
||||
m.value.height = 80
|
||||
|
||||
m.value.hintText = "Enter a value..."
|
||||
m.value.maxTextLength = 100
|
||||
end sub
|
||||
|
||||
sub itemContentChanged()
|
||||
data = m.top.itemContent
|
||||
|
||||
m.name.text = data.label
|
||||
if data.type = "password"
|
||||
m.value.secureMode = true
|
||||
end if
|
||||
|
||||
m.value.text = data.value
|
||||
end sub
|
||||
|
||||
sub setColors()
|
||||
if m.top.itemHasFocus
|
||||
color = "#101010FF"
|
||||
else
|
||||
color = "#ffffffFF"
|
||||
end if
|
||||
|
||||
m.name.color = color
|
||||
m.value.textColor = color
|
||||
|
||||
end sub
|
|
@ -12,52 +12,5 @@
|
|||
<field id="itemHasFocus" type="boolean" onChange="setColors" />
|
||||
</interface>
|
||||
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
m.name = m.top.findNode("label")
|
||||
m.value = m.top.findNode("value")
|
||||
|
||||
m.top.layoutDirection = "horiz"
|
||||
m.top.vertAlignment = "top"
|
||||
|
||||
m.name.width = 250
|
||||
m.name.height = 80
|
||||
|
||||
m.name.vertAlign = "center"
|
||||
m.name.horizAlign = "center"
|
||||
|
||||
' TODO - calculate "width" better... this is total item - (label + spacings)
|
||||
m.value.width = 1000 - 230
|
||||
m.value.height = 80
|
||||
|
||||
m.value.hintText = "Enter a value..."
|
||||
m.value.maxTextLength = 100
|
||||
end sub
|
||||
|
||||
sub itemContentChanged()
|
||||
data = m.top.itemContent
|
||||
|
||||
m.name.text = data.label
|
||||
if data.type = "password"
|
||||
m.value.secureMode = true
|
||||
end if
|
||||
|
||||
m.value.text = data.value
|
||||
end sub
|
||||
|
||||
sub setColors()
|
||||
if m.top.itemHasFocus
|
||||
color = "#101010FF"
|
||||
else
|
||||
color = "#ffffffFF"
|
||||
end if
|
||||
|
||||
m.name.color = color
|
||||
m.value.textColor = color
|
||||
|
||||
end sub
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<script type="text/brightscript" uri="item.brs" />
|
||||
</component>
|
||||
|
|
70
components/config/list.brs
Normal file
70
components/config/list.brs
Normal file
|
@ -0,0 +1,70 @@
|
|||
sub init()
|
||||
m.top.itemComponentName = "ConfigItem"
|
||||
|
||||
m.top.drawFocusFeedback = True
|
||||
m.top.vertFocusAnimationStyle = "floatingFocus"
|
||||
|
||||
m.top.observeField("itemSelected", "onItemSelected")
|
||||
|
||||
m.top.itemSize = [1000, 80]
|
||||
m.top.itemSpacing = [0, 20]
|
||||
m.top.vertAlign = "middle"
|
||||
|
||||
m.top.setfocus(true)
|
||||
|
||||
end sub
|
||||
|
||||
function setData()
|
||||
items = m.top.configItems
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
data.appendChildren(items)
|
||||
|
||||
m.top.content = data
|
||||
end function
|
||||
|
||||
function onItemSelected()
|
||||
i = m.top.itemSelected
|
||||
itemField = m.top.content.getchild(i)
|
||||
|
||||
show_dialog(itemField)
|
||||
|
||||
end function
|
||||
|
||||
function onDialogButton()
|
||||
d = m.dialog
|
||||
button_text = d.buttons[d.buttonSelected]
|
||||
|
||||
if button_text = "OK"
|
||||
m.configField.value = d.text
|
||||
dismiss_dialog()
|
||||
return true
|
||||
else if button_text = "Cancel"
|
||||
dismiss_dialog()
|
||||
return true
|
||||
end if
|
||||
end function
|
||||
|
||||
|
||||
sub show_dialog(configField)
|
||||
dialog = createObject("roSGNode", "KeyboardDialog")
|
||||
m.configField = configField
|
||||
dialog.title = "Enter the " + configField.label
|
||||
dialog.buttons = ["OK", "Cancel"]
|
||||
|
||||
if configField.type = "password"
|
||||
dialog.keyboard.textEditBox.secureMode = true
|
||||
end if
|
||||
|
||||
if configField.value <> ""
|
||||
dialog.text = configField.value
|
||||
end if
|
||||
|
||||
m.top.getparent().dialog = dialog
|
||||
m.dialog = dialog
|
||||
|
||||
dialog.observeField("buttonSelected", "onDialogButton")
|
||||
end sub
|
||||
|
||||
sub dismiss_dialog()
|
||||
m.dialog.close = true
|
||||
end sub
|
|
@ -4,78 +4,5 @@
|
|||
<field id="configItems" type="nodearray" onChange="setData" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" />
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
m.top.itemComponentName = "ConfigItem"
|
||||
|
||||
m.top.drawFocusFeedback = True
|
||||
m.top.vertFocusAnimationStyle = "floatingFocus"
|
||||
|
||||
m.top.observeField("itemSelected", "onItemSelected")
|
||||
|
||||
m.top.itemSize = [1000, 80]
|
||||
m.top.itemSpacing = [0, 20]
|
||||
m.top.vertAlign = "middle"
|
||||
|
||||
m.top.setfocus(true)
|
||||
|
||||
end sub
|
||||
|
||||
function setData()
|
||||
items = m.top.configItems
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
data.appendChildren(items)
|
||||
|
||||
m.top.content = data
|
||||
end function
|
||||
|
||||
function onItemSelected()
|
||||
i = m.top.itemSelected
|
||||
itemField = m.top.content.getchild(i)
|
||||
|
||||
show_dialog(itemField)
|
||||
|
||||
end function
|
||||
|
||||
function onDialogButton()
|
||||
d = m.dialog
|
||||
button_text = d.buttons[d.buttonSelected]
|
||||
|
||||
if button_text = "OK"
|
||||
m.configField.value = d.text
|
||||
dismiss_dialog()
|
||||
return true
|
||||
else if button_text = "Cancel"
|
||||
dismiss_dialog()
|
||||
return true
|
||||
end if
|
||||
end function
|
||||
|
||||
|
||||
sub show_dialog(configField)
|
||||
dialog = createObject("roSGNode", "KeyboardDialog")
|
||||
m.configField = configField
|
||||
dialog.title = "Enter the " + configField.label
|
||||
dialog.buttons = ["OK", "Cancel"]
|
||||
|
||||
if configField.type = "password"
|
||||
dialog.keyboard.textEditBox.secureMode = true
|
||||
end if
|
||||
|
||||
if configField.value <> ""
|
||||
dialog.text = configField.value
|
||||
end if
|
||||
|
||||
m.top.getparent().dialog = dialog
|
||||
m.dialog = dialog
|
||||
|
||||
dialog.observeField("buttonSelected", "onDialogButton")
|
||||
end sub
|
||||
|
||||
sub dismiss_dialog()
|
||||
m.dialog.close = true
|
||||
end sub
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="list.brs" />
|
||||
</component>
|
||||
|
|
|
@ -22,5 +22,5 @@
|
|||
font="font:MediumSystemFont"
|
||||
translation="[150, 550]" />
|
||||
</children>
|
||||
<script type="text/brightscript" uri="pkg:/components/config/scene.brs"/>
|
||||
<script type="text/brightscript" uri="scene.brs"/>
|
||||
</component>
|
||||
|
|
16
components/data/collection.brs
Normal file
16
components/data/collection.brs
Normal file
|
@ -0,0 +1,16 @@
|
|||
sub setFields()
|
||||
datum = m.top.json
|
||||
|
||||
m.top.id = datum.id
|
||||
m.top.title = datum.name
|
||||
m.top.overview = datum.overview
|
||||
|
||||
m.top.favorite = datum.UserData.isFavorite
|
||||
m.top.watched = datum.UserData.played
|
||||
|
||||
if datum.posterURL <> invalid
|
||||
m.top.posterURL = datum.posterURL
|
||||
else
|
||||
m.top.posterURL = ""
|
||||
end if
|
||||
end sub
|
|
@ -10,24 +10,5 @@
|
|||
<field id="watched" type="boolean" />
|
||||
<field id="json" type="associativearray" onChange="setFields" />
|
||||
</interface>
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub setFields()
|
||||
datum = m.top.json
|
||||
|
||||
m.top.id = datum.id
|
||||
m.top.title = datum.name
|
||||
m.top.overview = datum.overview
|
||||
|
||||
m.top.favorite = datum.UserData.isFavorite
|
||||
m.top.watched = datum.UserData.played
|
||||
|
||||
if datum.posterURL <> invalid
|
||||
m.top.posterURL = datum.posterURL
|
||||
else
|
||||
m.top.posterURL = ""
|
||||
end if
|
||||
end sub
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="collection.brs" />
|
||||
</component>
|
||||
|
|
7
components/data/image.brs
Normal file
7
components/data/image.brs
Normal file
|
@ -0,0 +1,7 @@
|
|||
sub setFields()
|
||||
json = m.top.json
|
||||
m.top.imagetype = json.imagetype
|
||||
m.top.size = json.size
|
||||
m.top.height = json.height
|
||||
m.top.width = json.width
|
||||
end sub
|
|
@ -8,15 +8,5 @@
|
|||
<field id="width" type="integer" />
|
||||
<field id="url" type="string" />
|
||||
</interface>
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub setFields()
|
||||
json = m.top.json
|
||||
m.top.imagetype = json.imagetype
|
||||
m.top.size = json.size
|
||||
m.top.height = json.height
|
||||
m.top.width = json.width
|
||||
end sub
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="image.brs" />
|
||||
</component>
|
||||
|
|
9
components/data/library.brs
Normal file
9
components/data/library.brs
Normal file
|
@ -0,0 +1,9 @@
|
|||
sub setData()
|
||||
' We keep json around just as a reference,
|
||||
' but ideally everything should be going through one of the interfaces
|
||||
datum = m.top.json
|
||||
|
||||
m.top.id = datum.id
|
||||
m.top.name = datum.name
|
||||
m.top.type = datum.CollectionType
|
||||
end sub
|
|
@ -6,18 +6,5 @@
|
|||
<field id="type" type="string" />
|
||||
<field id="json" type="associativearray" onChange="setData" />
|
||||
</interface>
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub setData()
|
||||
' We keep json around just as a reference,
|
||||
' but ideally everything should be going through one of the interfaces
|
||||
datum = m.top.json
|
||||
|
||||
m.top.id = datum.id
|
||||
m.top.name = datum.name
|
||||
m.top.type = datum.CollectionType
|
||||
end sub
|
||||
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="library.brs" />
|
||||
</component>
|
||||
|
|
38
components/data/movie.brs
Normal file
38
components/data/movie.brs
Normal file
|
@ -0,0 +1,38 @@
|
|||
sub setFields()
|
||||
json = m.top.json
|
||||
|
||||
m.top.id = json.id
|
||||
m.top.title = json.name
|
||||
m.top.overview = json.overview
|
||||
m.top.favorite = json.UserData.isFavorite
|
||||
m.top.watched = json.UserData.played
|
||||
|
||||
setPoster()
|
||||
setContainer()
|
||||
end sub
|
||||
|
||||
sub setPoster()
|
||||
json = m.top.json
|
||||
|
||||
if json.posterURL <> invalid
|
||||
m.top.posterURL = json.posterURL
|
||||
else
|
||||
m.top.posterURL = ""
|
||||
end if
|
||||
|
||||
end sub
|
||||
|
||||
sub setContainer()
|
||||
json = m.top.json
|
||||
|
||||
if json.mediaSources = invalid then return
|
||||
if json.mediaSources.count() = 0 then return
|
||||
|
||||
m.top.container = json.mediaSources[0].container
|
||||
|
||||
if m.top.container = invalid then m.top.container = ""
|
||||
|
||||
if m.top.container = "m4v" or m.top.container = "mov"
|
||||
m.top.container = "mp4"
|
||||
end if
|
||||
end sub
|
|
@ -11,46 +11,5 @@
|
|||
<field id="container" type="string" />
|
||||
<field id="json" type="associativearray" onChange="setFields" />
|
||||
</interface>
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub setFields()
|
||||
json = m.top.json
|
||||
|
||||
m.top.id = json.id
|
||||
m.top.title = json.name
|
||||
m.top.overview = json.overview
|
||||
m.top.favorite = json.UserData.isFavorite
|
||||
m.top.watched = json.UserData.played
|
||||
|
||||
setPoster()
|
||||
setContainer()
|
||||
end sub
|
||||
|
||||
sub setPoster()
|
||||
json = m.top.json
|
||||
|
||||
if json.posterURL <> invalid
|
||||
m.top.posterURL = json.posterURL
|
||||
else
|
||||
m.top.posterURL = ""
|
||||
end if
|
||||
|
||||
end sub
|
||||
|
||||
sub setContainer()
|
||||
json = m.top.json
|
||||
|
||||
if json.mediaSources = invalid then return
|
||||
if json.mediaSources.count() = 0 then return
|
||||
|
||||
m.top.container = json.mediaSources[0].container
|
||||
|
||||
if m.top.container = invalid then m.top.container = ""
|
||||
|
||||
if m.top.container = "m4v" or m.top.container = "mov"
|
||||
m.top.container = "mp4"
|
||||
end if
|
||||
end sub
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="movie.brs" />
|
||||
</component>
|
||||
|
|
6
components/data/options-button.brs
Normal file
6
components/data/options-button.brs
Normal file
|
@ -0,0 +1,6 @@
|
|||
sub init()
|
||||
end sub
|
||||
|
||||
sub press()
|
||||
m.top.escape = true
|
||||
end sub
|
|
@ -5,14 +5,5 @@
|
|||
<function name="press" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" />
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
end sub
|
||||
|
||||
sub press()
|
||||
m.top.escape = true
|
||||
end sub
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="options-button.brs" />
|
||||
</component>
|
||||
|
|
38
components/data/options-choices.brs
Normal file
38
components/data/options-choices.brs
Normal file
|
@ -0,0 +1,38 @@
|
|||
sub init()
|
||||
m.top.value_index = 0
|
||||
end sub
|
||||
|
||||
sub update_title()
|
||||
if m.top.choices.count() = 0
|
||||
m.top.title = m.top.base_title + ": <none>"
|
||||
return
|
||||
end if
|
||||
|
||||
for i=0 to m.top.choices.count() - 1
|
||||
if m.top.choices[i].value = m.top.value
|
||||
m.top.value_index = i
|
||||
exit for
|
||||
end if
|
||||
end for
|
||||
m.top.title = m.top.base_title + ": " + m.top.choices[m.top.value_index].display
|
||||
end sub
|
||||
|
||||
sub press()
|
||||
max_opt = m.top.choices.count()
|
||||
i = m.top.value_index + 1
|
||||
while i >= max_opt
|
||||
i = i - max_opt
|
||||
end while
|
||||
|
||||
m.top.value_index = i
|
||||
m.top.value = m.top.choices[m.top.value_index].value
|
||||
|
||||
if m.top.config_key = "" or m.top.config_key = invalid
|
||||
return
|
||||
end if
|
||||
if m.top.global_setting
|
||||
set_setting(m.top.config_key, m.top.value)
|
||||
else
|
||||
set_user_setting(m.top.config_key, m.top.value)
|
||||
end if
|
||||
end sub
|
|
@ -10,46 +10,5 @@
|
|||
<function name="press" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" />
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
m.top.value_index = 0
|
||||
end sub
|
||||
|
||||
sub update_title()
|
||||
if m.top.choices.count() = 0
|
||||
m.top.title = m.top.base_title + ": <none>"
|
||||
return
|
||||
end if
|
||||
|
||||
for i=0 to m.top.choices.count() - 1
|
||||
if m.top.choices[i].value = m.top.value
|
||||
m.top.value_index = i
|
||||
exit for
|
||||
end if
|
||||
end for
|
||||
m.top.title = m.top.base_title + ": " + m.top.choices[m.top.value_index].display
|
||||
end sub
|
||||
|
||||
sub press()
|
||||
max_opt = m.top.choices.count()
|
||||
i = m.top.value_index + 1
|
||||
while i >= max_opt
|
||||
i = i - max_opt
|
||||
end while
|
||||
|
||||
m.top.value_index = i
|
||||
m.top.value = m.top.choices[m.top.value_index].value
|
||||
|
||||
if m.top.config_key = "" or m.top.config_key = invalid
|
||||
return
|
||||
end if
|
||||
if m.top.global_setting
|
||||
set_setting(m.top.config_key, m.top.value)
|
||||
else
|
||||
set_user_setting(m.top.config_key, m.top.value)
|
||||
end if
|
||||
end sub
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="options-choices.brs" />
|
||||
</component>
|
||||
|
|
13
components/data/search-result.brs
Normal file
13
components/data/search-result.brs
Normal file
|
@ -0,0 +1,13 @@
|
|||
sub setFields()
|
||||
datum = m.top.json
|
||||
|
||||
m.top.id = datum.id
|
||||
m.top.title = datum.name
|
||||
m.top.type = datum.Type
|
||||
|
||||
if datum.posterURL <> invalid
|
||||
m.top.posterURL = datum.posterURL
|
||||
else
|
||||
m.top.posterURL = ""
|
||||
end if
|
||||
end sub
|
|
@ -7,21 +7,5 @@
|
|||
<field id="posterUrl" type="string" />
|
||||
<field id="json" type="associativearray" onChange="setFields" />
|
||||
</interface>
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub setFields()
|
||||
datum = m.top.json
|
||||
|
||||
m.top.id = datum.id
|
||||
m.top.title = datum.name
|
||||
m.top.type = datum.Type
|
||||
|
||||
if datum.posterURL <> invalid
|
||||
m.top.posterURL = datum.posterURL
|
||||
else
|
||||
m.top.posterURL = ""
|
||||
end if
|
||||
end sub
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="search-result.brs" />
|
||||
</component>
|
||||
|
|
15
components/data/series.brs
Normal file
15
components/data/series.brs
Normal file
|
@ -0,0 +1,15 @@
|
|||
sub setFields()
|
||||
datum = m.top.json
|
||||
m.top.id = datum.id
|
||||
m.top.title = datum.name
|
||||
m.top.overview = datum.overview
|
||||
|
||||
if datum.posterURL <> invalid
|
||||
m.top.posterURL = datum.posterURL
|
||||
else
|
||||
m.top.posterURL = ""
|
||||
end if
|
||||
|
||||
'm.top.seasons = TVSeasons(datum.id)
|
||||
'm.top.nextup = TVNext(datum.id)
|
||||
end sub
|
|
@ -10,23 +10,5 @@
|
|||
<field id="json" type="associativearray" onChange="setFields" />
|
||||
<function name="loadSeasons" />
|
||||
</interface>
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub setFields()
|
||||
datum = m.top.json
|
||||
m.top.id = datum.id
|
||||
m.top.title = datum.name
|
||||
m.top.overview = datum.overview
|
||||
|
||||
if datum.posterURL <> invalid
|
||||
m.top.posterURL = datum.posterURL
|
||||
else
|
||||
m.top.posterURL = ""
|
||||
end if
|
||||
|
||||
'm.top.seasons = TVSeasons(datum.id)
|
||||
'm.top.nextup = TVNext(datum.id)
|
||||
end sub
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="series.brs" />
|
||||
</component>
|
||||
|
|
15
components/data/tvepisode.brs
Normal file
15
components/data/tvepisode.brs
Normal file
|
@ -0,0 +1,15 @@
|
|||
sub setFields()
|
||||
datum = m.top.json
|
||||
|
||||
m.top.id = datum.id
|
||||
m.top.title = datum.name
|
||||
m.top.showID = datum.SeriesID
|
||||
m.top.seasonID = datum.SeasonID
|
||||
m.top.overview = datum.overview
|
||||
|
||||
if datum.posterURL <> invalid
|
||||
m.top.posterURL = datum.posterURL
|
||||
else
|
||||
m.top.posterURL = ""
|
||||
end if
|
||||
end sub
|
|
@ -10,23 +10,5 @@
|
|||
<field id="json" type="associativearray" onChange="setFields" />
|
||||
<function name="loadSeasons" />
|
||||
</interface>
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub setFields()
|
||||
datum = m.top.json
|
||||
|
||||
m.top.id = datum.id
|
||||
m.top.title = datum.name
|
||||
m.top.showID = datum.SeriesID
|
||||
m.top.seasonID = datum.SeasonID
|
||||
m.top.overview = datum.overview
|
||||
|
||||
if datum.posterURL <> invalid
|
||||
m.top.posterURL = datum.posterURL
|
||||
else
|
||||
m.top.posterURL = ""
|
||||
end if
|
||||
end sub
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="tvepisode.brs" />
|
||||
</component>
|
||||
|
|
13
components/data/tvseason.brs
Normal file
13
components/data/tvseason.brs
Normal file
|
@ -0,0 +1,13 @@
|
|||
sub setFields()
|
||||
datum = m.top.json
|
||||
|
||||
m.top.id = datum.id
|
||||
m.top.title = datum.name
|
||||
m.top.overview = datum.overview
|
||||
|
||||
if datum.posterURL <> invalid
|
||||
m.top.posterURL = datum.posterURL
|
||||
else
|
||||
m.top.posterURL = ""
|
||||
end if
|
||||
end sub
|
|
@ -8,21 +8,5 @@
|
|||
<field id="json" type="associativearray" onChange="setFields" />
|
||||
<function name="getPoster" />
|
||||
</interface>
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub setFields()
|
||||
datum = m.top.json
|
||||
|
||||
m.top.id = datum.id
|
||||
m.top.title = datum.name
|
||||
m.top.overview = datum.overview
|
||||
|
||||
if datum.posterURL <> invalid
|
||||
m.top.posterURL = datum.posterURL
|
||||
else
|
||||
m.top.posterURL = ""
|
||||
end if
|
||||
end sub
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="tvseason.brs" />
|
||||
</component>
|
||||
|
|
65
components/data/user.brs
Normal file
65
components/data/user.brs
Normal file
|
@ -0,0 +1,65 @@
|
|||
sub setDataFromJSON()
|
||||
json = m.top.json
|
||||
loadFromJSON(json)
|
||||
end sub
|
||||
|
||||
function loadFromJSON(json)
|
||||
m.top.id = json.User.id
|
||||
|
||||
m.top.username = json.User.name
|
||||
m.top.token = json.AccessToken
|
||||
end function
|
||||
|
||||
function loadFromRegistry(id as string)
|
||||
m.top.id = id
|
||||
|
||||
m.top.username = get_user_setting("username")
|
||||
m.top.token = get_user_setting("token")
|
||||
end function
|
||||
|
||||
function saveToRegistry()
|
||||
set_user_setting("username", m.top.username)
|
||||
set_user_setting("token", m.top.token)
|
||||
|
||||
users = parseJson(get_setting("available_users", "[]"))
|
||||
this_user = invalid
|
||||
for each user in users
|
||||
if user.id = m.top.id then this_user = user
|
||||
end for
|
||||
if this_user = invalid
|
||||
users.push({
|
||||
id: m.top.id,
|
||||
username: m.top.username,
|
||||
server: get_setting("server"),
|
||||
port: get_setting("port")
|
||||
})
|
||||
set_setting("available_users", formatJson(users))
|
||||
end if
|
||||
end function
|
||||
|
||||
function removeFromRegistry()
|
||||
new_users = []
|
||||
users = parseJson(get_setting("available_users", "[]"))
|
||||
for each user in users
|
||||
if m.top.id <> user.id then new_users.push(user)
|
||||
end for
|
||||
|
||||
set_setting("available_users", formatJson(new_users))
|
||||
end function
|
||||
|
||||
function getPreference(key as string, default as string)
|
||||
return get_user_setting("pref-" + key, default)
|
||||
end function
|
||||
|
||||
function setPreference(key as string, value as string)
|
||||
return set_user_setting("pref-" + key, value)
|
||||
end function
|
||||
|
||||
function setActive()
|
||||
set_setting("active_user", m.top.id)
|
||||
end function
|
||||
|
||||
function setServer(hostname as string, port as string)
|
||||
m.top.server = hostname
|
||||
m.top.port = port
|
||||
end function
|
|
@ -15,73 +15,5 @@
|
|||
<function name="setActive" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" />
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub setDataFromJSON()
|
||||
json = m.top.json
|
||||
loadFromJSON(json)
|
||||
end sub
|
||||
|
||||
function loadFromJSON(json)
|
||||
m.top.id = json.User.id
|
||||
|
||||
m.top.username = json.User.name
|
||||
m.top.token = json.AccessToken
|
||||
end function
|
||||
|
||||
function loadFromRegistry(id as String)
|
||||
m.top.id = id
|
||||
|
||||
m.top.username = get_user_setting("username")
|
||||
m.top.token = get_user_setting("token")
|
||||
end function
|
||||
|
||||
function saveToRegistry()
|
||||
set_user_setting("username", m.top.username)
|
||||
set_user_setting("token", m.top.token)
|
||||
|
||||
users = parseJson(get_setting("available_users", "[]"))
|
||||
this_user = invalid
|
||||
for each user in users
|
||||
if user.id = m.top.id then this_user = user
|
||||
end for
|
||||
if this_user = invalid
|
||||
users.push({
|
||||
id: m.top.id,
|
||||
username: m.top.username,
|
||||
server: get_setting("server"),
|
||||
port: get_setting("port")
|
||||
})
|
||||
set_setting("available_users", formatJson(users))
|
||||
end if
|
||||
end function
|
||||
|
||||
function removeFromRegistry()
|
||||
new_users = []
|
||||
users = parseJson(get_setting("available_users", "[]"))
|
||||
for each user in users
|
||||
if m.top.id <> user.id then new_users.push(user)
|
||||
end for
|
||||
|
||||
set_setting("available_users", formatJson(new_users))
|
||||
end function
|
||||
|
||||
function getPreference(key as String, default as String)
|
||||
return get_user_setting("pref-" + key, default)
|
||||
end function
|
||||
|
||||
function setPreference(key as String, value as String)
|
||||
return set_user_setting("pref-" + key, value)
|
||||
end function
|
||||
|
||||
function setActive()
|
||||
set_setting("active_user", m.top.id)
|
||||
end function
|
||||
|
||||
function setServer(hostname as string, port as string)
|
||||
m.top.server = hostname
|
||||
m.top.port = port
|
||||
end function
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="user.brs" />
|
||||
</component>
|
||||
|
|
23
components/library/item.brs
Normal file
23
components/library/item.brs
Normal file
|
@ -0,0 +1,23 @@
|
|||
sub init()
|
||||
itemText = m.top.findNode("itemText")
|
||||
itemText.text = "Loading..."
|
||||
|
||||
updateSize()
|
||||
end sub
|
||||
|
||||
sub updateSize()
|
||||
itemText = m.top.findNode("itemText")
|
||||
maxSize = m.top.getParent().itemSize
|
||||
itemText.width = maxSize[0]
|
||||
|
||||
itemText.translation = [0, (maxSize[1] / 2) - 15]
|
||||
end sub
|
||||
|
||||
function itemContentChanged() as void
|
||||
itemData = m.top.itemContent
|
||||
if itemData = invalid then return
|
||||
|
||||
itemText = m.top.findNode("itemText")
|
||||
itemText.text = itemData.name
|
||||
updateSize()
|
||||
end function
|
|
@ -6,33 +6,5 @@
|
|||
<interface>
|
||||
<field id="itemContent" type="node" onChange="itemContentChanged"/>
|
||||
</interface>
|
||||
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
itemText = m.top.findNode("itemText")
|
||||
itemText.text = "Loading..."
|
||||
|
||||
updateSize()
|
||||
end sub
|
||||
|
||||
sub updateSize()
|
||||
itemText = m.top.findNode("itemText")
|
||||
maxSize = m.top.getParent().itemSize
|
||||
itemText.width = maxSize[0]
|
||||
|
||||
itemText.translation = [0, (maxSize[1] / 2) - 15]
|
||||
end sub
|
||||
|
||||
function itemContentChanged() as void
|
||||
itemData = m.top.itemContent
|
||||
if itemData = invalid then return
|
||||
|
||||
itemText = m.top.findNode("itemText")
|
||||
itemText.text = itemData.name
|
||||
updateSize()
|
||||
end function
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<script type="text/brightscript" uri="item.brs" />
|
||||
</component>
|
||||
|
|
99
components/library/rowlist.brs
Normal file
99
components/library/rowlist.brs
Normal file
|
@ -0,0 +1,99 @@
|
|||
sub init()
|
||||
m.top.itemComponentName = "LibItem"
|
||||
m.top.content = getData()
|
||||
|
||||
m.top.rowFocusAnimationStyle = "floatingFocus"
|
||||
m.top.vertFocusAnimationStyle = "floatingFocus"
|
||||
|
||||
m.top.showRowLabel = [false]
|
||||
|
||||
updateSize()
|
||||
|
||||
m.top.setfocus(true)
|
||||
end sub
|
||||
|
||||
sub updateSize()
|
||||
m.top.numrows = 1
|
||||
m.top.rowSize = 5
|
||||
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
|
||||
border = 200
|
||||
m.top.translation = [border, border + 115]
|
||||
|
||||
itemWidth = (dimensions["width"] - border*2) / m.top.rowSize
|
||||
itemHeight = 75
|
||||
|
||||
m.top.visible = true
|
||||
|
||||
' size of the whole row
|
||||
m.top.itemSize = [dimensions["width"] - border*2, itemHeight]
|
||||
' spacing between rows
|
||||
m.top.itemSpacing = [ 0, 30 ]
|
||||
|
||||
' size of the item in the row
|
||||
m.top.rowItemSize = [ itemWidth, itemHeight ]
|
||||
' spacing between items in a row
|
||||
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")
|
||||
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.appendChild(item)
|
||||
end for
|
||||
end for
|
||||
return data
|
||||
end function
|
||||
|
||||
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()
|
||||
search = m.top.getScene().findNode("search")
|
||||
search.setFocus(true)
|
||||
search.findNode("search-input").setFocus(true)
|
||||
search.findNode("search-input").active = true
|
||||
return true
|
||||
else if key = "options"
|
||||
options = m.top.getScene().findNode("options")
|
||||
list = options.findNode("panelList")
|
||||
|
||||
options.visible = true
|
||||
list.setFocus(true)
|
||||
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
|
@ -4,107 +4,5 @@
|
|||
<field id="rowSize" type="int" />
|
||||
<field id="libList" type="associativearray" onChange="setData" />
|
||||
</interface>
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
m.top.itemComponentName = "LibItem"
|
||||
m.top.content = getData()
|
||||
|
||||
m.top.rowFocusAnimationStyle = "floatingFocus"
|
||||
m.top.vertFocusAnimationStyle = "floatingFocus"
|
||||
|
||||
m.top.showRowLabel = [false]
|
||||
|
||||
updateSize()
|
||||
|
||||
m.top.setfocus(true)
|
||||
end sub
|
||||
|
||||
sub updateSize()
|
||||
m.top.numrows = 1
|
||||
m.top.rowSize = 5
|
||||
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
|
||||
border = 200
|
||||
m.top.translation = [border, border + 115]
|
||||
|
||||
itemWidth = (dimensions["width"] - border*2) / m.top.rowSize
|
||||
itemHeight = 75
|
||||
|
||||
m.top.visible = true
|
||||
|
||||
' size of the whole row
|
||||
m.top.itemSize = [dimensions["width"] - border*2, itemHeight]
|
||||
' spacing between rows
|
||||
m.top.itemSpacing = [ 0, 30 ]
|
||||
|
||||
' size of the item in the row
|
||||
m.top.rowItemSize = [ itemWidth, itemHeight ]
|
||||
' spacing between items in a row
|
||||
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")
|
||||
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.appendChild(item)
|
||||
end for
|
||||
end for
|
||||
return data
|
||||
end function
|
||||
|
||||
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()
|
||||
search = m.top.getScene().findNode("search")
|
||||
search.setFocus(true)
|
||||
search.findNode("search-input").setFocus(true)
|
||||
search.findNode("search-input").active = true
|
||||
return true
|
||||
else if key = "options"
|
||||
options = m.top.getScene().findNode("options")
|
||||
list = options.findNode("panelList")
|
||||
|
||||
options.visible = true
|
||||
list.setFocus(true)
|
||||
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="rowlist.brs"/>
|
||||
</component>
|
||||
|
|
|
@ -1,5 +1,17 @@
|
|||
sub init()
|
||||
main = m.top.findNode("main_group")
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
|
||||
main.translation=[50, 50]
|
||||
|
||||
overview = m.top.findNode("overview")
|
||||
overview.width = dimensions.width - 100 - 400
|
||||
|
||||
m.top.findNode("buttons").setFocus(true)
|
||||
end sub
|
||||
|
||||
sub itemContentChanged()
|
||||
' Updates video metadata
|
||||
' Updates video metadata
|
||||
item = m.top.itemContent
|
||||
itemData = item.json
|
||||
|
||||
|
@ -45,7 +57,7 @@ sub setFieldText(field as string, value)
|
|||
node.text = value
|
||||
end sub
|
||||
|
||||
function getRuntime() as Integer
|
||||
function getRuntime() as integer
|
||||
itemData = m.top.itemContent.json
|
||||
|
||||
' A tick is .1ms, so 1/10,000,000 for ticks to seconds,
|
||||
|
@ -100,7 +112,7 @@ sub setWatchedColor()
|
|||
end if
|
||||
end sub
|
||||
|
||||
function round(f as Float) as Integer
|
||||
function round(f as float) as integer
|
||||
' BrightScript only has a "floor" round
|
||||
' This compares floor to floor + 1 to find which is closer
|
||||
m = int(f)
|
||||
|
|
|
@ -33,20 +33,5 @@
|
|||
<field id="itemContent" type="node" onChange="itemContentChanged" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/misc.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/components/movies/details.brs" />
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
main = m.top.findNode("main_group")
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
|
||||
main.translation=[50, 50]
|
||||
|
||||
overview = m.top.findNode("overview")
|
||||
overview.width = dimensions.width - 100 - 400
|
||||
|
||||
m.top.findNode("buttons").setFocus(true)
|
||||
end sub
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="details.brs" />
|
||||
</component>
|
||||
|
|
13
components/movies/minimal-details.brs
Normal file
13
components/movies/minimal-details.brs
Normal file
|
@ -0,0 +1,13 @@
|
|||
sub Init()
|
||||
m.title = m.top.findNode("title")
|
||||
m.title.text = "Loading..."
|
||||
end sub
|
||||
|
||||
function itemContentChanged() as void
|
||||
' re-declare this because init doesnt re-run
|
||||
' when we come back from elsewhere
|
||||
m.title = m.top.findNode("title")
|
||||
|
||||
itemData = m.top.itemContent
|
||||
m.title.text = itemData.title
|
||||
end function
|
|
@ -12,22 +12,6 @@
|
|||
<field id="itemContent" type="node" onChange="itemContentChanged"/>
|
||||
</interface>
|
||||
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub Init()
|
||||
m.title = m.top.findNode("title")
|
||||
m.title.text = "Loading..."
|
||||
end sub
|
||||
|
||||
function itemContentChanged() as void
|
||||
' re-declare this because init doesnt re-run
|
||||
' when we come back from elsewhere
|
||||
m.title = m.top.findNode("title")
|
||||
|
||||
itemData = m.top.itemContent
|
||||
m.title.text = itemData.title
|
||||
end function
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="minimal-details.brs" />
|
||||
|
||||
</component>
|
||||
|
|
98
components/movies/rowlist.brs
Normal file
98
components/movies/rowlist.brs
Normal file
|
@ -0,0 +1,98 @@
|
|||
sub init()
|
||||
m.top.itemComponentName = "ListPoster"
|
||||
m.top.content = getData()
|
||||
|
||||
m.top.rowFocusAnimationStyle = "floatingFocus"
|
||||
'm.top.vertFocusAnimationStyle = "floatingFocus"
|
||||
|
||||
m.top.showRowLabel = [false]
|
||||
|
||||
updateSize()
|
||||
|
||||
m.top.setfocus(true)
|
||||
end sub
|
||||
|
||||
sub updateSize()
|
||||
m.top.numrows = 1
|
||||
m.top.rowSize = 5
|
||||
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
|
||||
border = 75
|
||||
m.top.translation = [border, border + 115]
|
||||
|
||||
textHeight = 75
|
||||
' Do we decide width by rowSize, or rowSize by width...
|
||||
itemWidth = (dimensions["width"] - border*2) / m.top.rowSize
|
||||
itemHeight = itemWidth * 1.5 + textHeight
|
||||
|
||||
m.top.visible = true
|
||||
|
||||
' 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 ]
|
||||
end sub
|
||||
|
||||
function setData()
|
||||
movieData = m.top.movieData
|
||||
rowsize = m.top.rowSize
|
||||
|
||||
n = movieData.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()
|
||||
if m.top.movieData = invalid then
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
return data
|
||||
end if
|
||||
|
||||
movieData = m.top.movieData
|
||||
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 > movieData.items.count() then
|
||||
exit for
|
||||
end if
|
||||
row.appendChild(movieData.items[index-1])
|
||||
end for
|
||||
end for
|
||||
return data
|
||||
end function
|
||||
|
||||
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
|
||||
else if key = "options"
|
||||
options = m.top.getScene().findNode("options")
|
||||
list = options.findNode("panelList")
|
||||
|
||||
options.visible = true
|
||||
list.setFocus(true)
|
||||
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
|
@ -5,106 +5,5 @@
|
|||
<field id="movieData" type="associativearray" onChange="setData" />
|
||||
<field id="library" type="associativearray" />
|
||||
</interface>
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
m.top.itemComponentName = "ListPoster"
|
||||
m.top.content = getData()
|
||||
|
||||
m.top.rowFocusAnimationStyle = "floatingFocus"
|
||||
'm.top.vertFocusAnimationStyle = "floatingFocus"
|
||||
|
||||
m.top.showRowLabel = [false]
|
||||
|
||||
updateSize()
|
||||
|
||||
m.top.setfocus(true)
|
||||
end sub
|
||||
|
||||
sub updateSize()
|
||||
m.top.numrows = 1
|
||||
m.top.rowSize = 5
|
||||
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
|
||||
border = 75
|
||||
m.top.translation = [border, border + 115]
|
||||
|
||||
textHeight = 75
|
||||
' Do we decide width by rowSize, or rowSize by width...
|
||||
itemWidth = (dimensions["width"] - border*2) / m.top.rowSize
|
||||
itemHeight = itemWidth * 1.5 + textHeight
|
||||
|
||||
m.top.visible = true
|
||||
|
||||
' 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 ]
|
||||
end sub
|
||||
|
||||
function setData()
|
||||
movieData = m.top.movieData
|
||||
rowsize = m.top.rowSize
|
||||
|
||||
n = movieData.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()
|
||||
if m.top.movieData = invalid then
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
return data
|
||||
end if
|
||||
|
||||
movieData = m.top.movieData
|
||||
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 > movieData.items.count() then
|
||||
exit for
|
||||
end if
|
||||
row.appendChild(movieData.items[index-1])
|
||||
end for
|
||||
end for
|
||||
return data
|
||||
end function
|
||||
|
||||
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
|
||||
else if key = "options"
|
||||
options = m.top.getScene().findNode("options")
|
||||
list = options.findNode("panelList")
|
||||
|
||||
options.visible = true
|
||||
list.setFocus(true)
|
||||
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="rowlist.brs" />
|
||||
</component>
|
||||
|
|
48
components/options/panel.brs
Normal file
48
components/options/panel.brs
Normal file
|
@ -0,0 +1,48 @@
|
|||
sub init()
|
||||
m.top.visible = false
|
||||
|
||||
panel = m.top.findNode("panel")
|
||||
panel.panelSize = "small"
|
||||
panel.leftPosition = 0
|
||||
panel.focusable = true
|
||||
panel.hasNextPanel = false
|
||||
panel.leftOnly = true
|
||||
|
||||
list = m.top.findNode("panelList")
|
||||
|
||||
panel.list = list
|
||||
|
||||
bd = m.top.findNode("backdrop")
|
||||
bd.color = "#101010DD"
|
||||
bd.translation = [0, 0]
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
bd.width = 575
|
||||
bd.height = dimensions.height
|
||||
end sub
|
||||
|
||||
sub setFields()
|
||||
options = m.top.options
|
||||
buttons = m.top.buttons
|
||||
row = m.top.findNode("fieldList")
|
||||
|
||||
row.clear()
|
||||
row.appendChildren(options)
|
||||
row.appendChildren(buttons)
|
||||
end sub
|
||||
|
||||
function onKeyEvent(key as string, press as boolean) as boolean
|
||||
if not press then return false
|
||||
|
||||
if key = "options"
|
||||
m.top.visible = false
|
||||
m.top.escape = true
|
||||
return true
|
||||
else if key = "OK"
|
||||
list = m.top.findNode("panelList")
|
||||
data = list.content.getChild(list.itemFocused)
|
||||
data.callFunc("press")
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
|
@ -13,56 +13,5 @@
|
|||
<field id="options" type="nodearray" onChange="setFields" />
|
||||
<field id="escape" type="boolean" alwaysNotify="true" />
|
||||
</interface>
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
m.top.visible = false
|
||||
|
||||
panel = m.top.findNode("panel")
|
||||
panel.panelSize = "small"
|
||||
panel.leftPosition = 0
|
||||
panel.focusable = true
|
||||
panel.hasNextPanel = false
|
||||
panel.leftOnly = true
|
||||
|
||||
list = m.top.findNode("panelList")
|
||||
|
||||
panel.list = list
|
||||
|
||||
bd = m.top.findNode("backdrop")
|
||||
bd.color = "#101010DD"
|
||||
bd.translation = [0, 0]
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
bd.width = 575
|
||||
bd.height = dimensions.height
|
||||
end sub
|
||||
|
||||
sub setFields()
|
||||
options = m.top.options
|
||||
buttons = m.top.buttons
|
||||
row = m.top.findNode("fieldList")
|
||||
|
||||
row.clear()
|
||||
row.appendChildren(options)
|
||||
row.appendChildren(buttons)
|
||||
end sub
|
||||
|
||||
function onKeyEvent(key as string, press as boolean) as boolean
|
||||
if not press then return false
|
||||
|
||||
if key = "options"
|
||||
m.top.visible = false
|
||||
m.top.escape = true
|
||||
return true
|
||||
else if key = "OK"
|
||||
list = m.top.findNode("panelList")
|
||||
data = list.content.getChild(list.itemFocused)
|
||||
data.callFunc("press")
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="panel.brs" />
|
||||
</component>
|
||||
|
|
85
components/search/rowlist.brs
Normal file
85
components/search/rowlist.brs
Normal file
|
@ -0,0 +1,85 @@
|
|||
sub init()
|
||||
m.top.itemComponentName = "ListPoster"
|
||||
m.top.content = getData()
|
||||
|
||||
updateSize()
|
||||
|
||||
m.top.showRowLabel = [ true ]
|
||||
m.top.rowLabelOffset = [0, 20]
|
||||
m.top.showRowCounter = [ true ]
|
||||
|
||||
' TODO - Define a failed to load image background
|
||||
' m.top.failedBitmapURI
|
||||
|
||||
m.top.setFocus(true)
|
||||
end sub
|
||||
|
||||
sub updateSize()
|
||||
' In search results, rowSize only dictates how many are on screen at once
|
||||
m.top.rowSize = 5
|
||||
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
|
||||
border = 75
|
||||
m.top.translation = [border, border + 115]
|
||||
|
||||
textHeight = 50
|
||||
itemWidth = (dimensions["width"] - border * 2) / m.top.rowSize
|
||||
itemHeight = itemWidth * 1.5 + textHeight
|
||||
|
||||
m.top.itemSize = [dimensions["width"] - border*2, itemHeight]
|
||||
m.top.itemSpacing = [0, 50]
|
||||
|
||||
m.top.rowItemSize = [ itemWidth, itemHeight ]
|
||||
m.top.rowItemSpacing = [0, 0]
|
||||
end sub
|
||||
|
||||
function getData()
|
||||
if m.top.itemData = invalid then
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
return data
|
||||
end if
|
||||
|
||||
itemData = m.top.itemData
|
||||
rowSize = m.top.rowSize
|
||||
|
||||
' todo - Or get the old data? I can't remember...
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
' Do this to keep the ordering, AssociateArrays have no order
|
||||
type_array = ["Movie", "Episode", "AlbumArtist", "Album", "Audio", "Person"]
|
||||
content_types = {
|
||||
"Movie": {"label": "Movies", "count": 0},
|
||||
"Episode": {"label": "Episodes", "count": 0},
|
||||
"AlbumArtist": {"label": "Artists", "count": 0},
|
||||
"Album": {"label": "Albums", "count": 0},
|
||||
"Audio": {"label": "Songs", "count": 0},
|
||||
"Person": {"label": "People", "count": 0}
|
||||
}
|
||||
|
||||
for each item in itemData.searchHints
|
||||
if content_types[item.type] <> invalid
|
||||
content_types[item.type].count += 1
|
||||
end if
|
||||
end for
|
||||
|
||||
for each ctype in type_array
|
||||
content_type = content_types[ctype]
|
||||
if content_type.count > 0
|
||||
addRow(data, content_type.label, ctype)
|
||||
end if
|
||||
end for
|
||||
|
||||
m.top.content = data
|
||||
return data
|
||||
end function
|
||||
|
||||
function addRow(data, title, type_filter)
|
||||
itemData = m.top.itemData
|
||||
row = data.CreateChild("ContentNode")
|
||||
row.title = title
|
||||
for each item in itemData.SearchHints
|
||||
if item.type = type_filter
|
||||
row.appendChild(item)
|
||||
end if
|
||||
end for
|
||||
end function
|
|
@ -6,93 +6,5 @@
|
|||
<field id="query" type="string" />
|
||||
<field id="itemSelected" type="int" />
|
||||
</interface>
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
m.top.itemComponentName = "ListPoster"
|
||||
m.top.content = getData()
|
||||
|
||||
updateSize()
|
||||
|
||||
m.top.showRowLabel = [ true ]
|
||||
m.top.rowLabelOffset = [0, 20]
|
||||
m.top.showRowCounter = [ true ]
|
||||
|
||||
' TODO - Define a failed to load image background
|
||||
' m.top.failedBitmapURI
|
||||
|
||||
m.top.setFocus(true)
|
||||
end sub
|
||||
|
||||
sub updateSize()
|
||||
' In search results, rowSize only dictates how many are on screen at once
|
||||
m.top.rowSize = 5
|
||||
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
|
||||
border = 75
|
||||
m.top.translation = [border, border + 115]
|
||||
|
||||
textHeight = 50
|
||||
itemWidth = (dimensions["width"] - border * 2) / m.top.rowSize
|
||||
itemHeight = itemWidth * 1.5 + textHeight
|
||||
|
||||
m.top.itemSize = [dimensions["width"] - border*2, itemHeight]
|
||||
m.top.itemSpacing = [0, 50]
|
||||
|
||||
m.top.rowItemSize = [ itemWidth, itemHeight ]
|
||||
m.top.rowItemSpacing = [0, 0]
|
||||
end sub
|
||||
|
||||
function getData()
|
||||
if m.top.itemData = invalid then
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
return data
|
||||
end if
|
||||
|
||||
itemData = m.top.itemData
|
||||
rowSize = m.top.rowSize
|
||||
|
||||
' todo - Or get the old data? I can't remember...
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
' Do this to keep the ordering, AssociateArrays have no order
|
||||
type_array = ["Movie", "Episode", "AlbumArtist", "Album", "Audio", "Person"]
|
||||
content_types = {
|
||||
"Movie": {"label": "Movies", "count": 0},
|
||||
"Episode": {"label": "Episodes", "count": 0},
|
||||
"AlbumArtist": {"label": "Artists", "count": 0},
|
||||
"Album": {"label": "Albums", "count": 0},
|
||||
"Audio": {"label": "Songs", "count": 0},
|
||||
"Person": {"label": "People", "count": 0}
|
||||
}
|
||||
|
||||
for each item in itemData.searchHints
|
||||
if content_types[item.type] <> invalid
|
||||
content_types[item.type].count += 1
|
||||
end if
|
||||
end for
|
||||
|
||||
for each ctype in type_array
|
||||
content_type = content_types[ctype]
|
||||
if content_type.count > 0
|
||||
addRow(data, content_type.label, ctype)
|
||||
end if
|
||||
end for
|
||||
|
||||
m.top.content = data
|
||||
return data
|
||||
end function
|
||||
|
||||
function addRow(data, title, type_filter)
|
||||
itemData = m.top.itemData
|
||||
row = data.CreateChild("ContentNode")
|
||||
row.title = title
|
||||
for each item in itemData.SearchHints
|
||||
if item.type = type_filter
|
||||
row.appendChild(item)
|
||||
end if
|
||||
end for
|
||||
end function
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="rowlist.brs" />
|
||||
</component>
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<component name="SearchResults" extends="Scene">
|
||||
<children>
|
||||
<SearchRow
|
||||
id="SearchSelect"
|
||||
visible="true"
|
||||
/>
|
||||
<Overhang
|
||||
id="overhang"
|
||||
title="Search"
|
||||
/>
|
||||
<SearchRow id="SearchSelect" visible="true" />
|
||||
<Overhang id="overhang" title="Search" />
|
||||
</children>
|
||||
</component>
|
||||
|
|
32
components/tvshows/details.brs
Normal file
32
components/tvshows/details.brs
Normal file
|
@ -0,0 +1,32 @@
|
|||
sub init()
|
||||
set = m.top.findNode("panelset")
|
||||
set.height = 1080
|
||||
|
||||
panel = set.findNode("panel-desc")
|
||||
panel.panelSize = "full"
|
||||
panel.hasNextPanel = true
|
||||
panel.isFullScreen = true
|
||||
panel.leftPosition = 150
|
||||
|
||||
panel2 = set.findNode("panel-seasons")
|
||||
panel2.panelSize = "full"
|
||||
panel2.hasNextPanel = false
|
||||
panel2.isFullScreen = true
|
||||
panel2.leftPosition = 150
|
||||
' TODO - set the bounds so seasons dont go off the edge of the screen
|
||||
end sub
|
||||
|
||||
sub panelFocusChanged()
|
||||
set = m.top.findNode("panelset")
|
||||
index = m.top.panelFocused
|
||||
|
||||
if index = 0
|
||||
' Description page
|
||||
' TODO - get the buttons to actually take focus back
|
||||
set.findNode("description").findNode("buttons").setFocus(true)
|
||||
else if index = 1
|
||||
' Seasons page
|
||||
set.findNode("seasons").setFocus(true)
|
||||
end if
|
||||
|
||||
end sub
|
|
@ -13,45 +13,7 @@
|
|||
<interface>
|
||||
<field id="itemData" type="node" alias="description.itemContent" />
|
||||
<field id="seasonData" type="associativearray" alias="seasons.TVSeasonData" />
|
||||
<field id="panelFocused"
|
||||
alias="panelset.leftPanelIndex"
|
||||
type="integer"
|
||||
onChange="panelFocusChanged" />
|
||||
<field id="panelFocused" alias="panelset.leftPanelIndex" type="integer" onChange="panelFocusChanged" />
|
||||
</interface>
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
set = m.top.findNode("panelset")
|
||||
set.height = 1080
|
||||
|
||||
panel = set.findNode("panel-desc")
|
||||
panel.panelSize = "full"
|
||||
panel.hasNextPanel = true
|
||||
panel.isFullScreen = true
|
||||
panel.leftPosition = 150
|
||||
|
||||
panel2 = set.findNode("panel-seasons")
|
||||
panel2.panelSize = "full"
|
||||
panel2.hasNextPanel = false
|
||||
panel2.isFullScreen = true
|
||||
panel2.leftPosition = 150
|
||||
' TODO - set the bounds so seasons dont go off the edge of the screen
|
||||
end sub
|
||||
|
||||
sub panelFocusChanged()
|
||||
set = m.top.findNode("panelset")
|
||||
index = m.top.panelFocused
|
||||
|
||||
if index = 0
|
||||
' Description page
|
||||
' TODO - get the buttons to actually take focus back
|
||||
set.findNode("description").findNode("buttons").setFocus(true)
|
||||
else if index = 1
|
||||
' Seasons page
|
||||
set.findNode("seasons").setFocus(true)
|
||||
end if
|
||||
|
||||
end sub
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="details.brs" />
|
||||
</component>
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
sub init()
|
||||
buttons = m.top.findNode("buttons")
|
||||
|
||||
buttons.iconUri = ""
|
||||
|
||||
for each button in buttons.getChildren(-1, 0)
|
||||
button.maxWidth = 350
|
||||
button.minWidth = 350
|
||||
end for
|
||||
end sub
|
||||
|
||||
sub itemContentChanged()
|
||||
' Updates video metadata
|
||||
' Updates video metadata
|
||||
' TODO - make things use item rather than itemData
|
||||
item = m.top.itemContent
|
||||
itemData = item.json
|
||||
|
@ -40,7 +51,7 @@ sub setFieldText(field as string, value)
|
|||
node.text = value
|
||||
end sub
|
||||
|
||||
function getRuntime() as Integer
|
||||
function getRuntime() as integer
|
||||
itemData = m.top.itemContent.json
|
||||
|
||||
' A tick is .1ms, so 1/10,000,000 for ticks to seconds,
|
||||
|
@ -87,7 +98,7 @@ function getHistory() as string
|
|||
airtime = itemData.airtime
|
||||
if airtime <> invalid and airdays.count() = 1
|
||||
airwords = airdays[0] + " at " + airtime
|
||||
endif
|
||||
end if
|
||||
|
||||
if itemData.studios.count() > 0
|
||||
studio = itemData.studios[0].name
|
||||
|
@ -108,7 +119,7 @@ function getHistory() as string
|
|||
return words
|
||||
end function
|
||||
|
||||
function round(f as Float) as Integer
|
||||
function round(f as float) as integer
|
||||
' BrightScript only has a "floor" round
|
||||
' This compares floor to floor + 1 to find which is closer
|
||||
m = int(f)
|
||||
|
|
|
@ -25,19 +25,5 @@
|
|||
<interface>
|
||||
<field id="itemContent" type="node" onChange="itemContentChanged" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="pkg:/components/tvshows/group-description.brs" />
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
buttons = m.top.findNode("buttons")
|
||||
|
||||
buttons.iconUri = ""
|
||||
|
||||
for each button in buttons.getChildren(-1, 0)
|
||||
button.maxWidth = 350
|
||||
button.minWidth = 350
|
||||
end for
|
||||
end sub
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="group-description.brs" />
|
||||
</component>
|
||||
|
|
66
components/tvshows/rowlist-episode.brs
Normal file
66
components/tvshows/rowlist-episode.brs
Normal file
|
@ -0,0 +1,66 @@
|
|||
sub init()
|
||||
m.top.itemComponentName = "ListPoster"
|
||||
|
||||
m.top.rowFocusAnimationStyle = "floatingFocus"
|
||||
|
||||
updateSize()
|
||||
|
||||
m.top.setFocus(true)
|
||||
end sub
|
||||
|
||||
sub updateSize()
|
||||
m.top.numRows = 1
|
||||
m.top.rowSize = 5
|
||||
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
|
||||
border = 75
|
||||
m.top.translation = [border, border + 115]
|
||||
|
||||
textHeight = 75
|
||||
itemWidth = (dimensions["width"] - border*2) / m.top.rowSize
|
||||
itemHeight = itemWidth * 1.5 + textHeight
|
||||
|
||||
m.top.visible = true
|
||||
|
||||
m.top.itemSize = [dimensions["width"] - border*2, itemHeight]
|
||||
m.top.itemSpacing = [ 0, 10 ]
|
||||
|
||||
m.top.rowItemSize = [ itemWidth, itemHeight ]
|
||||
m.top.rowItemSpacing = [ 0, 0 ]
|
||||
|
||||
|
||||
episodeData = m.top.TVEpisodeData
|
||||
|
||||
if episodeData = invalid then return
|
||||
|
||||
rowsize = m.top.rowSize
|
||||
|
||||
n = episodeData.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
|
||||
end sub
|
||||
|
||||
function getData()
|
||||
if m.top.TVEpisodeData = invalid then
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
return data
|
||||
end if
|
||||
|
||||
updateSize()
|
||||
|
||||
episodeData = m.top.TVEpisodeData
|
||||
rowsize = m.top.rowSize
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
row = data.CreateChild("ContentNode")
|
||||
for each item in episodeData.items
|
||||
row.appendChild(item)
|
||||
end for
|
||||
m.top.content = data
|
||||
return data
|
||||
end function
|
|
@ -4,74 +4,5 @@
|
|||
<field id="rowSize" type="int" />
|
||||
<field id="TVEpisodeData" type="associativearray" onChange="getData" />
|
||||
</interface>
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
m.top.itemComponentName = "ListPoster"
|
||||
|
||||
m.top.rowFocusAnimationStyle = "floatingFocus"
|
||||
|
||||
updateSize()
|
||||
|
||||
m.top.setFocus(true)
|
||||
end sub
|
||||
|
||||
sub updateSize()
|
||||
m.top.numRows = 1
|
||||
m.top.rowSize = 5
|
||||
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
|
||||
border = 75
|
||||
m.top.translation = [border, border + 115]
|
||||
|
||||
textHeight = 75
|
||||
itemWidth = (dimensions["width"] - border*2) / m.top.rowSize
|
||||
itemHeight = itemWidth * 1.5 + textHeight
|
||||
|
||||
m.top.visible = true
|
||||
|
||||
m.top.itemSize = [dimensions["width"] - border*2, itemHeight]
|
||||
m.top.itemSpacing = [ 0, 10 ]
|
||||
|
||||
m.top.rowItemSize = [ itemWidth, itemHeight ]
|
||||
m.top.rowItemSpacing = [ 0, 0 ]
|
||||
|
||||
|
||||
episodeData = m.top.TVEpisodeData
|
||||
|
||||
if episodeData = invalid then return
|
||||
|
||||
rowsize = m.top.rowSize
|
||||
|
||||
n = episodeData.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
|
||||
end sub
|
||||
|
||||
function getData()
|
||||
if m.top.TVEpisodeData = invalid then
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
return data
|
||||
end if
|
||||
|
||||
updateSize()
|
||||
|
||||
episodeData = m.top.TVEpisodeData
|
||||
rowsize = m.top.rowSize
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
row = data.CreateChild("ContentNode")
|
||||
for each item in episodeData.items
|
||||
row.appendChild(item)
|
||||
end for
|
||||
m.top.content = data
|
||||
return data
|
||||
end function
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="rowlist-episode.brs" />
|
||||
</component>
|
||||
|
|
59
components/tvshows/rowlist-season.brs
Normal file
59
components/tvshows/rowlist-season.brs
Normal file
|
@ -0,0 +1,59 @@
|
|||
sub init()
|
||||
m.top.itemComponentName = "ListPoster"
|
||||
m.top.content = getData()
|
||||
|
||||
'm.top.rowFocusAnimationStyle = "floatingFocus"
|
||||
'm.top.vertFocusAnimationStyle = "floatingFocus"
|
||||
|
||||
m.top.showRowLabel = [true]
|
||||
m.top.rowLabelOffset = [0, 20]
|
||||
|
||||
updateSize()
|
||||
|
||||
m.top.setfocus(true)
|
||||
end sub
|
||||
|
||||
sub updateSize()
|
||||
' Infinite scroll, rowsize is just how many show on screen at once
|
||||
m.top.rowSize = 5
|
||||
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
|
||||
border = 50
|
||||
m.top.translation = [border, border]
|
||||
|
||||
textHeight = 75
|
||||
' Do we decide width by rowSize, or rowSize by width...
|
||||
itemWidth = (dimensions["width"] - border*2) / m.top.rowSize
|
||||
itemHeight = itemWidth * 1.5 + textHeight
|
||||
|
||||
m.top.visible = true
|
||||
|
||||
' 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 ]
|
||||
end sub
|
||||
|
||||
function getData()
|
||||
if m.top.TVSeasonData = invalid then
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
return data
|
||||
end if
|
||||
|
||||
seasonData = m.top.TVSeasonData
|
||||
rowsize = m.top.rowSize
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
row = data.CreateChild("ContentNode")
|
||||
row.title = "Seasons"
|
||||
for each item in seasonData.items
|
||||
row.appendChild(item)
|
||||
end for
|
||||
m.top.content = data
|
||||
return data
|
||||
end function
|
|
@ -4,68 +4,5 @@
|
|||
<field id="rowSize" type="int" />
|
||||
<field id="TVSeasonData" type="associativearray" onChange="getData" />
|
||||
</interface>
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
' TODO - make this not a "row" list
|
||||
sub init()
|
||||
m.top.itemComponentName = "ListPoster"
|
||||
m.top.content = getData()
|
||||
|
||||
'm.top.rowFocusAnimationStyle = "floatingFocus"
|
||||
'm.top.vertFocusAnimationStyle = "floatingFocus"
|
||||
|
||||
m.top.showRowLabel = [true]
|
||||
m.top.rowLabelOffset = [0, 20]
|
||||
|
||||
updateSize()
|
||||
|
||||
m.top.setfocus(true)
|
||||
end sub
|
||||
|
||||
sub updateSize()
|
||||
' Infinite scroll, rowsize is just how many show on screen at once
|
||||
m.top.rowSize = 5
|
||||
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
|
||||
border = 50
|
||||
m.top.translation = [border, border]
|
||||
|
||||
textHeight = 75
|
||||
' Do we decide width by rowSize, or rowSize by width...
|
||||
itemWidth = (dimensions["width"] - border*2) / m.top.rowSize
|
||||
itemHeight = itemWidth * 1.5 + textHeight
|
||||
|
||||
m.top.visible = true
|
||||
|
||||
' 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 ]
|
||||
end sub
|
||||
|
||||
function getData()
|
||||
if m.top.TVSeasonData = invalid then
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
return data
|
||||
end if
|
||||
|
||||
seasonData = m.top.TVSeasonData
|
||||
rowsize = m.top.rowSize
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
row = data.CreateChild("ContentNode")
|
||||
row.title = "Seasons"
|
||||
for each item in seasonData.items
|
||||
row.appendChild(item)
|
||||
end for
|
||||
m.top.content = data
|
||||
return data
|
||||
end function
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="rowlist-season.brs" />
|
||||
</component>
|
||||
|
|
99
components/tvshows/rowlist-show.brs
Normal file
99
components/tvshows/rowlist-show.brs
Normal file
|
@ -0,0 +1,99 @@
|
|||
sub init()
|
||||
m.top.itemComponentName = "ListPoster"
|
||||
m.top.content = getData()
|
||||
|
||||
|
||||
m.top.rowFocusAnimationStyle = "floatingFocus"
|
||||
'm.top.vertFocusAnimationStyle = "floatingFocus"
|
||||
|
||||
m.top.showRowLabel = [false]
|
||||
|
||||
updateSize()
|
||||
|
||||
m.top.setfocus(true)
|
||||
end sub
|
||||
|
||||
sub updateSize()
|
||||
m.top.numrows = 1
|
||||
m.top.rowSize = 5
|
||||
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
|
||||
border = 75
|
||||
m.top.translation = [border, border + 115]
|
||||
|
||||
textHeight = 75
|
||||
' Do we decide width by rowSize, or rowSize by width...
|
||||
itemWidth = (dimensions["width"] - border*2) / m.top.rowSize
|
||||
itemHeight = itemWidth * 1.5 + textHeight
|
||||
|
||||
m.top.visible = true
|
||||
|
||||
' 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 ]
|
||||
end sub
|
||||
|
||||
function setData()
|
||||
tvshowData = m.top.TVShowData
|
||||
rowsize = m.top.rowSize
|
||||
|
||||
n = tvshowData.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()
|
||||
if m.top.TVShowData = invalid then
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
return data
|
||||
end if
|
||||
|
||||
TVShowData = m.top.TVShowData
|
||||
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 > tvshowData.items.count() then
|
||||
exit for
|
||||
end if
|
||||
row.appendChild(tvShowData.items[index-1])
|
||||
end for
|
||||
end for
|
||||
return data
|
||||
end function
|
||||
|
||||
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
|
||||
else if key = "options"
|
||||
options = m.top.getScene().findNode("options")
|
||||
list = options.findNode("panelList")
|
||||
|
||||
options.visible = true
|
||||
list.setFocus(true)
|
||||
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
|
@ -4,107 +4,5 @@
|
|||
<field id="rowSize" type="int" />
|
||||
<field id="TVShowData" type="associativearray" onChange="setData" />
|
||||
</interface>
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
m.top.itemComponentName = "ListPoster"
|
||||
m.top.content = getData()
|
||||
|
||||
|
||||
m.top.rowFocusAnimationStyle = "floatingFocus"
|
||||
'm.top.vertFocusAnimationStyle = "floatingFocus"
|
||||
|
||||
m.top.showRowLabel = [false]
|
||||
|
||||
updateSize()
|
||||
|
||||
m.top.setfocus(true)
|
||||
end sub
|
||||
|
||||
sub updateSize()
|
||||
m.top.numrows = 1
|
||||
m.top.rowSize = 5
|
||||
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
|
||||
border = 75
|
||||
m.top.translation = [border, border + 115]
|
||||
|
||||
textHeight = 75
|
||||
' Do we decide width by rowSize, or rowSize by width...
|
||||
itemWidth = (dimensions["width"] - border*2) / m.top.rowSize
|
||||
itemHeight = itemWidth * 1.5 + textHeight
|
||||
|
||||
m.top.visible = true
|
||||
|
||||
' 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 ]
|
||||
end sub
|
||||
|
||||
function setData()
|
||||
tvshowData = m.top.TVShowData
|
||||
rowsize = m.top.rowSize
|
||||
|
||||
n = tvshowData.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()
|
||||
if m.top.TVShowData = invalid then
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
return data
|
||||
end if
|
||||
|
||||
TVShowData = m.top.TVShowData
|
||||
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 > tvshowData.items.count() then
|
||||
exit for
|
||||
end if
|
||||
row.appendChild(tvShowData.items[index-1])
|
||||
end for
|
||||
end for
|
||||
return data
|
||||
end function
|
||||
|
||||
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
|
||||
else if key = "options"
|
||||
options = m.top.getScene().findNode("options")
|
||||
list = options.findNode("panelList")
|
||||
|
||||
options.visible = true
|
||||
list.setFocus(true)
|
||||
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
||||
]]>
|
||||
</script>
|
||||
<script type="text/brightscript" uri="rowlist-show.brs" />
|
||||
</component>
|
||||
|
|
Loading…
Reference in New Issue
Block a user