Support left, right navigation while viewing photos
This commit is contained in:
parent
380c22cfc3
commit
78ab9e9233
|
@ -724,9 +724,10 @@ function onKeyEvent(key as string, press as boolean) as boolean
|
|||
return true
|
||||
else if itemToPlay <> invalid and itemToPlay.type = "Photo"
|
||||
' Spawn photo player task
|
||||
photoPlayer = CreateObject("roSgNode", "PhotoPlayerTask")
|
||||
photoPlayer.itemContent = itemToPlay
|
||||
photoPlayer.control = "RUN"
|
||||
photoPlayer = CreateObject("roSgNode", "PhotoDetails")
|
||||
photoPlayer.items = markupGrid
|
||||
photoPlayer.itemIndex = markupGrid.itemFocused
|
||||
m.global.sceneManager.callfunc("pushScene", photoPlayer)
|
||||
return true
|
||||
end if
|
||||
else if key = "left" and topGrp.isinFocusChain()
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
sub init()
|
||||
m.top.optionsAvailable = false ' Change once Shuffle option is added
|
||||
m.top.overhangVisible = false
|
||||
itemContentChanged()
|
||||
end sub
|
||||
|
||||
sub itemContentChanged()
|
||||
if isValidToContinue(m.top.itemIndex)
|
||||
m.LoadLibrariesTask = createObject("roSGNode", "LoadPhotoTask")
|
||||
m.LoadLibrariesTask.itemContent = m.top.itemContent
|
||||
itemContent = m.top.items.content.getChild(m.top.itemIndex)
|
||||
m.LoadLibrariesTask.itemContent = itemContent
|
||||
m.LoadLibrariesTask.observeField("results", "onPhotoLoaded")
|
||||
m.LoadLibrariesTask.control = "RUN"
|
||||
end if
|
||||
end sub
|
||||
|
||||
sub onPhotoLoaded()
|
||||
|
@ -19,3 +23,33 @@ sub onPhotoLoaded()
|
|||
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 = "right"
|
||||
if isValidToContinue(m.top.itemIndex + 1)
|
||||
m.top.itemIndex++
|
||||
end if
|
||||
return true
|
||||
end if
|
||||
|
||||
if key = "left"
|
||||
if isValidToContinue(m.top.itemIndex - 1)
|
||||
m.top.itemIndex--
|
||||
end if
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
||||
|
||||
function isValidToContinue(index as integer)
|
||||
if isValid(m.top.items) and isValid(m.top.items.content)
|
||||
if index >= 0 and index < m.top.items.content.getChildCount()
|
||||
return true
|
||||
end if
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
</LayoutGroup>
|
||||
</children>
|
||||
<interface>
|
||||
<field id="itemContent" type="node" onChange="itemContentChanged" />
|
||||
<field id="items" type="node" />
|
||||
<field id="itemIndex" type="integer" value="-1" onChange="itemContentChanged" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="PhotoDetails.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/misc.brs" />
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
sub init()
|
||||
m.top.functionName = "loadItems"
|
||||
end sub
|
||||
|
||||
sub loadItems()
|
||||
item = m.top.itemContent
|
||||
|
||||
group = CreateObject("roSGNode", "PhotoDetails")
|
||||
group.optionsAvailable = false
|
||||
m.global.sceneManager.callFunc("pushScene", group)
|
||||
|
||||
group.itemContent = item
|
||||
|
||||
' TODO/FIXME:
|
||||
' Wait some time and move to the next photo...
|
||||
|
||||
end sub
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
|
||||
<component name="PhotoPlayerTask" extends="Task">
|
||||
<interface>
|
||||
<field id="itemContent" type="node" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="PhotoPlayerTask.brs" />
|
||||
</component>
|
Loading…
Reference in New Issue
Block a user