spinner while loading

This commit is contained in:
Jimi 2022-07-17 10:14:12 -06:00 committed by 1hitsong
parent ebbb4deeb9
commit 9f5138a9f5
3 changed files with 8 additions and 11 deletions

View File

@ -9,6 +9,7 @@ sub init()
m.infoGroup = m.top.FindNode("infoGroup")
m.songListRect = m.top.FindNode("songListRect")
m.songList.observeField("doneLoading", "onDoneLoading")
m.spinner = m.top.findNode("spinner")
m.spinner.visible = true
@ -24,7 +25,6 @@ end sub
' Set values for displayed values on screen
sub pageContentChanged()
item = m.top.pageContent
m.spinner.visible = false
setPosterImage(item.posterURL)
setScreenTitle(item.json)
@ -165,6 +165,11 @@ sub createDialogPallete()
}
end sub
sub onDoneLoading()
m.songList.unobservefield("doneLoading")
m.spinner.visible = false
end sub
sub OnScreenHidden()
m.spinner.visible = false
end sub

View File

@ -1,6 +1,4 @@
sub init()
m.spinner = m.top.findNode("spinner")
m.top.content = getData()
m.top.setfocus(true)
end sub
@ -21,11 +19,7 @@ function getData()
m.top.content = data
hideSpinner()
m.top.doneLoading = true
return data
end function
sub hideSpinner()
m.spinner.visible = false
end sub

View File

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<component name="MusicAlbumSongList" extends="MarkupList">
<children>
<Spinner id="spinner" translation="[485, 150]" />
</children>
<interface>
<field id="MusicArtistAlbumData" type="assocarray" onChange="getData" />
<field id="doneLoading" type="boolean" value="false"/>
</interface>
<script type="text/brightscript" uri="MusicAlbumSongList.brs" />
</component>