Move home library loading into function

This commit is contained in:
Neil Burrows 2020-12-08 15:56:13 +00:00
parent ffcf5e48a7
commit f3019f3e7f
5 changed files with 11 additions and 1 deletions

View File

@ -6,3 +6,7 @@ end sub
function refresh() function refresh()
m.top.findNode("homeRows").callFunc("updateHomeRows") m.top.findNode("homeRows").callFunc("updateHomeRows")
end function end function
function loadLibraries()
m.top.findNode("homeRows").callFunc("loadLibraries")
end function

View File

@ -9,6 +9,7 @@
<field id="userConfig" alias="homeRows.userConfig" /> <field id="userConfig" alias="homeRows.userConfig" />
<field id="timeLastRefresh" type="integer" /> <field id="timeLastRefresh" type="integer" />
<function name="refresh" /> <function name="refresh" />
<function name="loadLibraries" />
</interface> </interface>
<script type="text/brightscript" uri="Home.brs" /> <script type="text/brightscript" uri="Home.brs" />
</component> </component>

View File

@ -21,7 +21,6 @@ sub init()
' Load the Libraries from API via task ' Load the Libraries from API via task
m.LoadLibrariesTask = createObject("roSGNode", "LoadItemsTask") m.LoadLibrariesTask = createObject("roSGNode", "LoadItemsTask")
m.LoadLibrariesTask.observeField("content", "onLibrariesLoaded") m.LoadLibrariesTask.observeField("content", "onLibrariesLoaded")
m.LoadLibrariesTask.control = "RUN"
' set up tesk nodes for other rows ' set up tesk nodes for other rows
m.LoadContinueTask = createObject("roSGNode", "LoadItemsTask") m.LoadContinueTask = createObject("roSGNode", "LoadItemsTask")
m.LoadContinueTask.itemsToLoad = "continue" m.LoadContinueTask.itemsToLoad = "continue"
@ -29,6 +28,10 @@ sub init()
m.LoadNextUpTask.itemsToLoad = "nextUp" m.LoadNextUpTask.itemsToLoad = "nextUp"
end sub end sub
function loadLibraries()
m.LoadLibrariesTask.control = "RUN"
end function
sub updateSize() sub updateSize()
sideborder = 100 sideborder = 100
m.top.translation = [111, 180] m.top.translation = [111, 180]

View File

@ -4,6 +4,7 @@
<field id="selectedItem" type="node" alwaysNotify="true" /> <field id="selectedItem" type="node" alwaysNotify="true" />
<field id="userConfig" type="assocarray" /> <field id="userConfig" type="assocarray" />
<function name="updateHomeRows" /> <function name="updateHomeRows" />
<function name="loadLibraries" />
</interface> </interface>
<script type="text/brightscript" uri="HomeRows.brs"/> <script type="text/brightscript" uri="HomeRows.brs"/>
</component> </component>

View File

@ -36,6 +36,7 @@ sub Main()
m.overhang.showOptions = true m.overhang.showOptions = true
group = CreateHomeGroup() group = CreateHomeGroup()
group.userConfig = m.user.configuration group.userConfig = m.user.configuration
group.callFunc("loadLibraries")
m.scene.appendChild(group) m.scene.appendChild(group)
m.scene.observeField("backPressed", m.port) m.scene.observeField("backPressed", m.port)