Use placeholders when no information to display (Show Image / Details)
This commit is contained in:
parent
15951d59e6
commit
a9516597fc
|
@ -5,6 +5,7 @@ sub init()
|
||||||
m.maxDetailLines = 14
|
m.maxDetailLines = 14
|
||||||
|
|
||||||
m.detailsView = m.top.findNode("detailsView")
|
m.detailsView = m.top.findNode("detailsView")
|
||||||
|
m.noInfoView = m.top.findNode("noInformation")
|
||||||
|
|
||||||
m.programName = m.top.findNode("programName")
|
m.programName = m.top.findNode("programName")
|
||||||
m.episodeTitle = m.top.findNode("episodeTitle")
|
m.episodeTitle = m.top.findNode("episodeTitle")
|
||||||
|
@ -52,6 +53,19 @@ sub setupLabels()
|
||||||
buttonBackground.height = boundingRect.height + 20
|
buttonBackground.height = boundingRect.height + 20
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
|
sub channelUpdated()
|
||||||
|
if m.top.channel = invalid
|
||||||
|
m.top.findNode("noInfoChannelName").text = ""
|
||||||
|
m.channelName.text = ""
|
||||||
|
else
|
||||||
|
m.top.findNode("noInfoChannelName").text = m.top.channel.Title
|
||||||
|
m.channelName.text= m.top.channel.Title
|
||||||
|
if m.top.programDetails = invalid then
|
||||||
|
m.image.uri = m.top.channel.posterURL
|
||||||
|
end if
|
||||||
|
end if
|
||||||
|
end sub
|
||||||
|
|
||||||
sub programUpdated()
|
sub programUpdated()
|
||||||
|
|
||||||
m.top.watchSelectedChannel = false
|
m.top.watchSelectedChannel = false
|
||||||
|
@ -60,7 +74,9 @@ sub programUpdated()
|
||||||
|
|
||||||
' If no program selected, hide details view
|
' If no program selected, hide details view
|
||||||
if prog = invalid then
|
if prog = invalid then
|
||||||
|
channelUpdated()
|
||||||
m.detailsView.visible = "false"
|
m.detailsView.visible = "false"
|
||||||
|
m.noInfoView.visible = "true"
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
@ -121,11 +137,9 @@ sub programUpdated()
|
||||||
|
|
||||||
m.image.uri = prog.PosterURL
|
m.image.uri = prog.PosterURL
|
||||||
|
|
||||||
if prog.channelName <> invalid and prog.channelName <> "" then
|
|
||||||
m.channelName.text = prog.channelName
|
|
||||||
end if
|
|
||||||
|
|
||||||
m.detailsView.visible = "true"
|
m.detailsView.visible = "true"
|
||||||
|
m.noInfoView.visible = "false"
|
||||||
|
|
||||||
m.top.height = m.detailsView.boundingRect().height
|
m.top.height = m.detailsView.boundingRect().height
|
||||||
m.overview.maxLines = m.maxPreviewLines
|
m.overview.maxLines = m.maxPreviewLines
|
||||||
|
|
|
@ -2,11 +2,12 @@
|
||||||
<component name="ProgramDetails" extends="JFGroup">
|
<component name="ProgramDetails" extends="JFGroup">
|
||||||
<children>
|
<children>
|
||||||
|
|
||||||
<Group id="detailsView">
|
<!-- Selected Item Details -->
|
||||||
<!-- Selected Item Details -->
|
<maskGroup id="backgroundMask" maskUri="pkg:/images/backgroundmask.png" translation="[1208, 127]" maskSize="[712,400]">
|
||||||
<maskGroup id="backgroundMask" maskUri="pkg:/images/backgroundmask.png" translation="[1208, 127]" maskSize="[712,400]">
|
<Poster id="image" height="400" width="712" loadDisplayMode="scaleToFit" />
|
||||||
<Poster id="image" height="400" width="712" />
|
</maskGroup>
|
||||||
</maskGroup>
|
|
||||||
|
<Group id="detailsView" visible="false">
|
||||||
|
|
||||||
<Group translation = "[ 96, 160 ]">
|
<Group translation = "[ 96, 160 ]">
|
||||||
<LayoutGroup itemSpacings="[4,20, 20, 20, 40]">
|
<LayoutGroup itemSpacings="[4,20, 20, 20, 40]">
|
||||||
|
@ -43,12 +44,18 @@
|
||||||
|
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
|
<!-- When no schedule information to display -->
|
||||||
|
<LayoutGroup id="noInformation" translation="[96, 300]">
|
||||||
|
<Label id="noInfoChannelName" font="font:LargeBoldSystemFont" />
|
||||||
|
<Label font="font:SmallSystemFont" text="No schedule information" />
|
||||||
|
</LayoutGroup>
|
||||||
<Animation id="focusAnimation" duration="0.66" repeat="false" easeFunction="linear" >
|
<Animation id="focusAnimation" duration="0.66" repeat="false" easeFunction="linear" >
|
||||||
<FloatFieldInterpolator id="focusAnimationOpacity" key="[0.0, 1]" fieldToInterp="viewChannelButton.opacity" />
|
<FloatFieldInterpolator id="focusAnimationOpacity" key="[0.0, 1]" fieldToInterp="viewChannelButton.opacity" />
|
||||||
</Animation>
|
</Animation>
|
||||||
</children>
|
</children>
|
||||||
<interface>
|
<interface>
|
||||||
<field id="WatchSelectedChannel" type="boolean" value="false" />
|
<field id="WatchSelectedChannel" type="boolean" value="false" />
|
||||||
|
<field id="channel" type="node" onchange="channelUpdated" />
|
||||||
<field id="programDetails" type="node" onchange="programUpdated" />
|
<field id="programDetails" type="node" onchange="programUpdated" />
|
||||||
<field id="height" type="integer" />
|
<field id="height" type="integer" />
|
||||||
<field id="hasFocus" type="boolean" onChange="focusChanged" />
|
<field id="hasFocus" type="boolean" onChange="focusChanged" />
|
||||||
|
|
|
@ -51,7 +51,6 @@ sub onChannelsLoaded()
|
||||||
m.LoadScheduleTask.channelIds = channelIdList
|
m.LoadScheduleTask.channelIds = channelIdList
|
||||||
m.LoadScheduleTask.control = "RUN"
|
m.LoadScheduleTask.control = "RUN"
|
||||||
|
|
||||||
|
|
||||||
m.LoadProgramDetailsTask = createObject("roSGNode", "LoadProgramDetailsTask")
|
m.LoadProgramDetailsTask = createObject("roSGNode", "LoadProgramDetailsTask")
|
||||||
m.LoadProgramDetailsTask.observeField("programDetails", "onProgramDetailsLoaded")
|
m.LoadProgramDetailsTask.observeField("programDetails", "onProgramDetailsLoaded")
|
||||||
|
|
||||||
|
@ -83,6 +82,7 @@ sub onProgramFocused()
|
||||||
|
|
||||||
m.top.watchChannel = invalid
|
m.top.watchChannel = invalid
|
||||||
channel = m.scheduleGrid.content.GetChild(m.scheduleGrid.programFocusedDetails.focusChannelIndex)
|
channel = m.scheduleGrid.content.GetChild(m.scheduleGrid.programFocusedDetails.focusChannelIndex)
|
||||||
|
m.detailsPane.channel = channel
|
||||||
|
|
||||||
' Exit if Channels not yet loaded
|
' Exit if Channels not yet loaded
|
||||||
if channel.getChildCount() = 0 then
|
if channel.getChildCount() = 0 then
|
||||||
|
@ -92,7 +92,7 @@ sub onProgramFocused()
|
||||||
|
|
||||||
prog = channel.GetChild(m.scheduleGrid.programFocusedDetails.focusIndex)
|
prog = channel.GetChild(m.scheduleGrid.programFocusedDetails.focusIndex)
|
||||||
|
|
||||||
if prog.fullyLoaded = false then
|
if prog <> invalid and prog.fullyLoaded = false then
|
||||||
m.LoadProgramDetailsTask.programId = prog.Id
|
m.LoadProgramDetailsTask.programId = prog.Id
|
||||||
m.LoadProgramDetailsTask.channelIndex = m.scheduleGrid.programFocusedDetails.focusChannelIndex
|
m.LoadProgramDetailsTask.channelIndex = m.scheduleGrid.programFocusedDetails.focusChannelIndex
|
||||||
m.LoadProgramDetailsTask.programIndex = m.scheduleGrid.programFocusedDetails.focusIndex
|
m.LoadProgramDetailsTask.programIndex = m.scheduleGrid.programFocusedDetails.focusIndex
|
||||||
|
@ -100,14 +100,18 @@ sub onProgramFocused()
|
||||||
end if
|
end if
|
||||||
|
|
||||||
m.detailsPane.programDetails = prog
|
m.detailsPane.programDetails = prog
|
||||||
m.detailsPane.programDetails.channelName = channel.Title
|
|
||||||
|
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
' Update the Program Details with full information
|
' Update the Program Details with full information
|
||||||
sub onProgramDetailsLoaded()
|
sub onProgramDetailsLoaded()
|
||||||
if m.LoadProgramDetailsTask.programDetails = invalid then return
|
if m.LoadProgramDetailsTask.programDetails = invalid then return
|
||||||
channel = m.scheduleGrid.content.GetChild(m.LoadProgramDetailsTask.programDetails.channelIndex)
|
channel = m.scheduleGrid.content.GetChild(m.LoadProgramDetailsTask.programDetails.channelIndex)
|
||||||
|
|
||||||
|
' If TV Show does not have its own image, use the channel logo
|
||||||
|
if m.LoadProgramDetailsTask.programDetails.PosterUrl = invalid or m.LoadProgramDetailsTask.programDetails.PosterUrl = "" then
|
||||||
|
m.LoadProgramDetailsTask.programDetails.PosterUrl = channel.PosterUrl
|
||||||
|
end if
|
||||||
|
|
||||||
channel.ReplaceChild(m.LoadProgramDetailsTask.programDetails, m.LoadProgramDetailsTask.programDetails.programIndex)
|
channel.ReplaceChild(m.LoadProgramDetailsTask.programDetails, m.LoadProgramDetailsTask.programDetails.programIndex)
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user