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.detailsView = m.top.findNode("detailsView")
|
||||
m.noInfoView = m.top.findNode("noInformation")
|
||||
|
||||
m.programName = m.top.findNode("programName")
|
||||
m.episodeTitle = m.top.findNode("episodeTitle")
|
||||
|
@ -52,6 +53,19 @@ sub setupLabels()
|
|||
buttonBackground.height = boundingRect.height + 20
|
||||
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()
|
||||
|
||||
m.top.watchSelectedChannel = false
|
||||
|
@ -60,7 +74,9 @@ sub programUpdated()
|
|||
|
||||
' If no program selected, hide details view
|
||||
if prog = invalid then
|
||||
channelUpdated()
|
||||
m.detailsView.visible = "false"
|
||||
m.noInfoView.visible = "true"
|
||||
return
|
||||
end if
|
||||
|
||||
|
@ -121,12 +137,10 @@ sub programUpdated()
|
|||
|
||||
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.noInfoView.visible = "false"
|
||||
|
||||
m.top.height = m.detailsView.boundingRect().height
|
||||
m.overview.maxLines = m.maxPreviewLines
|
||||
end sub
|
||||
|
|
|
@ -2,11 +2,12 @@
|
|||
<component name="ProgramDetails" extends="JFGroup">
|
||||
<children>
|
||||
|
||||
<Group id="detailsView">
|
||||
<!-- Selected Item Details -->
|
||||
<maskGroup id="backgroundMask" maskUri="pkg:/images/backgroundmask.png" translation="[1208, 127]" maskSize="[712,400]">
|
||||
<Poster id="image" height="400" width="712" />
|
||||
</maskGroup>
|
||||
<!-- Selected Item Details -->
|
||||
<maskGroup id="backgroundMask" maskUri="pkg:/images/backgroundmask.png" translation="[1208, 127]" maskSize="[712,400]">
|
||||
<Poster id="image" height="400" width="712" loadDisplayMode="scaleToFit" />
|
||||
</maskGroup>
|
||||
|
||||
<Group id="detailsView" visible="false">
|
||||
|
||||
<Group translation = "[ 96, 160 ]">
|
||||
<LayoutGroup itemSpacings="[4,20, 20, 20, 40]">
|
||||
|
@ -43,12 +44,18 @@
|
|||
|
||||
</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" >
|
||||
<FloatFieldInterpolator id="focusAnimationOpacity" key="[0.0, 1]" fieldToInterp="viewChannelButton.opacity" />
|
||||
</Animation>
|
||||
</children>
|
||||
<interface>
|
||||
<field id="WatchSelectedChannel" type="boolean" value="false" />
|
||||
<field id="channel" type="node" onchange="channelUpdated" />
|
||||
<field id="programDetails" type="node" onchange="programUpdated" />
|
||||
<field id="height" type="integer" />
|
||||
<field id="hasFocus" type="boolean" onChange="focusChanged" />
|
||||
|
|
|
@ -51,7 +51,6 @@ sub onChannelsLoaded()
|
|||
m.LoadScheduleTask.channelIds = channelIdList
|
||||
m.LoadScheduleTask.control = "RUN"
|
||||
|
||||
|
||||
m.LoadProgramDetailsTask = createObject("roSGNode", "LoadProgramDetailsTask")
|
||||
m.LoadProgramDetailsTask.observeField("programDetails", "onProgramDetailsLoaded")
|
||||
|
||||
|
@ -83,7 +82,8 @@ sub onProgramFocused()
|
|||
|
||||
m.top.watchChannel = invalid
|
||||
channel = m.scheduleGrid.content.GetChild(m.scheduleGrid.programFocusedDetails.focusChannelIndex)
|
||||
|
||||
m.detailsPane.channel = channel
|
||||
|
||||
' Exit if Channels not yet loaded
|
||||
if channel.getChildCount() = 0 then
|
||||
m.detailsPane.programDetails = invalid
|
||||
|
@ -92,7 +92,7 @@ sub onProgramFocused()
|
|||
|
||||
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.channelIndex = m.scheduleGrid.programFocusedDetails.focusChannelIndex
|
||||
m.LoadProgramDetailsTask.programIndex = m.scheduleGrid.programFocusedDetails.focusIndex
|
||||
|
@ -100,14 +100,18 @@ sub onProgramFocused()
|
|||
end if
|
||||
|
||||
m.detailsPane.programDetails = prog
|
||||
m.detailsPane.programDetails.channelName = channel.Title
|
||||
|
||||
end sub
|
||||
|
||||
' Update the Program Details with full information
|
||||
sub onProgramDetailsLoaded()
|
||||
if m.LoadProgramDetailsTask.programDetails = invalid then return
|
||||
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)
|
||||
end sub
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user