Prevent spamming home refresh

This commit is contained in:
Charles Ewert 2020-03-25 00:20:37 -04:00
parent aa7f478bf8
commit e0fa6481ad
2 changed files with 6 additions and 2 deletions

View File

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

View File

@ -435,8 +435,11 @@ sub RemoveCurrentGroup()
group.setFocus(true)
end if
if group.subtype() = "Home" then
' refresh home page
group.callFunc("refresh")
currentTime = CreateObject("roDateTime").AsSeconds()
if group.timeLastRefresh = invalid or (currentTime - group.timeLastRefresh) > 20 then
group.timeLastRefresh = currentTime
group.callFunc("refresh")
end if
end if
group.visible = true
end sub