Cleaner implementation of hiding overhang data.

This commit is contained in:
Jimi 2022-02-13 13:53:30 -07:00
parent 8b6957ff30
commit 2133c5af24
6 changed files with 16 additions and 39 deletions

View File

@ -5,6 +5,7 @@
<field id="lastFocus" type="node" />
<field id="overhangTitle" type="string" />
<field id="optionsAvailable" value="true" type="boolean" />
<field id="overhangVisible" value="true" type="boolean" />
</interface>
<script type="text/brightscript" uri="JFGroup.brs" />
</component>

View File

@ -28,18 +28,6 @@ sub init()
updateTimeDisplay()
end sub
sub hideOverhang()
m.top.findNode("overlayLogo").visible = false
m.top.findNode("overlayLeftGroup").visible = false
m.top.findNode("overlayRightGroup").visible = false
end sub
sub showOverhang()
m.top.findNode("overlayLogo").visible = true
m.top.findNode("overlayLeftGroup").visible = true
m.top.findNode("overlayRightGroup").visible = true
end sub
sub updateTitle()
leftSeperator = m.top.findNode("overlayLeftSeperator")
if m.top.title <> ""

View File

@ -43,8 +43,6 @@
<field id="title" type="string" onChange="updateTitle" />
<field id="showOptions" value="true" type="boolean" onChange="updateOptions" />
<function name="resetTime" />
<function name="hideOverhang" />
<function name="showOverhang" />
</interface>
<script type="text/brightscript" uri="JFOverhang.brs" />
</component>

View File

@ -114,13 +114,6 @@ sub clearScenes()
m.groups = []
end sub
sub hideOverhang()
m.overhang.callFunc("hideOverhang")
end sub
sub showOverhang()
m.overhang.callFunc("showOverhang")
end sub
'
' Register observers for overhang data
@ -136,7 +129,13 @@ sub registerOverhangData(group)
group.observeField("optionsAvailable", "updateOptions")
group.observeField("overhangTitle", "updateOverhangTitle")
m.overhang.visible = true
if group.overhangVisible
m.overhang.visible = true
else
m.overhang.visible = false
end if
group.observeField("overhangVisible", "updateOverhangVisible")
else if group.isSubType("JFVideo")
m.overhang.visible = false
else
@ -166,6 +165,13 @@ sub updateOptions(msg)
end sub
'
' Update whether the overhang is visible or not
sub updateOverhangVisible(msg)
m.overhang.visible = msg.getData()
end sub
'
' Update username in overhang
sub updateUser()

View File

@ -7,8 +7,6 @@
<function name="clearScenes" />
<function name="resetTime" />
<function name="userMessage" />
<function name="hideOverhang" />
<function name="showOverhang" />
<field id="currentUser" type="string" onChange="updateUser" />
</interface>
<script type="text/brightscript" uri="SceneManager.brs" />

View File

@ -1,5 +1,6 @@
sub init()
m.top.optionsAvailable = false ' Change once Shuffle option is added
m.top.overhangVisible = false
end sub
sub itemContentChanged()
@ -13,23 +14,8 @@ sub onPhotoLoaded()
if m.LoadLibrariesTask.results <> invalid
photo = m.top.findNode("photo")
photo.uri = m.LoadLibrariesTask.results
' Hide overhang so it's not overlayed on top of the photo
m.global.sceneManager.callFunc("hideOverhang")
else
'Show user error here (for example if it's not a supported image type)
message_dialog("This image type is not supported.")
end if
end sub
function onKeyEvent(key as string, press as boolean) as boolean
if not press then return false
if key = "back"
' Restore overhang since it was hidden when showing the photo
m.global.sceneManager.callFunc("showOverhang")
end if
return false
end function