Hide overhang when viewing photos.

This commit is contained in:
Jimi 2022-02-06 15:37:40 -07:00
parent c15e554862
commit 68df29c6ca
8 changed files with 43 additions and 16 deletions

View File

@ -460,18 +460,19 @@ function onKeyEvent(key as string, press as boolean) as boolean
optionsClosed()
return true
end if
else if key = "play"
else if key = "play" or key = "OK"
markupGrid = m.top.getChild(2)
itemToPlay = markupGrid.content.getChild(markupGrid.itemFocused)
if itemToPlay <> invalid and (itemToPlay.type = "Movie" or itemToPlay.type = "Episode")
m.top.quickPlayNode = itemToPlay
else if itemToPlay <> invalid and (itemToPlay.type = "Photo" or itemToPlay.type = "PhotoAlbum" or itemToPlay.type = "Folder")
return true
else if itemToPlay <> invalid and itemToPlay.type = "Photo"
' Spawn photo player task
photoPlayer = CreateObject("roSgNode", "PhotoPlayerTask")
photoPlayer.itemContent = itemToPlay
photoPlayer.control = "RUN"
return true
end if
return true
end if
return false
end function

View File

@ -28,6 +28,17 @@ 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")

View File

@ -43,6 +43,8 @@
<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,6 +114,13 @@ 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

View File

@ -7,6 +7,8 @@
<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,5 @@
sub init()
m.top.optionsAvailable = true
m.top.optionsAvailable = false ' Change once Shuffle option is added
end sub
sub itemContentChanged()
@ -13,8 +13,23 @@ 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

View File

@ -136,8 +136,7 @@ sub Main (args as dynamic) as void
m.scene.dialog.observeField("buttonSelected", m.port)
end if
else if selectedItem.type = "Photo"
' Show selected photo
group = CreatePhotoPage(selectedItem)
' Nothing to do here, handled in ItemGrid
else
' TODO - switch on more node types
message_dialog("This type is not yet supported: " + selectedItem.type + ".")

View File

@ -375,16 +375,6 @@ function CreateVideoPlayerGroup(video_id, audio_stream_idx = 1)
return video
end function
function CreatePhotoPage(photo)
group = CreateObject("roSGNode", "PhotoDetails")
group.optionsAvailable = true
m.global.sceneManager.callFunc("pushScene", group)
group.itemContent = photo
return group
end function
sub UpdateSavedServerList()
server = get_setting("server")
username = get_setting("username")