diff --git a/components/liveTv/ProgramDetails.brs b/components/liveTv/ProgramDetails.brs index 5355c0cd..b2dd03d7 100644 --- a/components/liveTv/ProgramDetails.brs +++ b/components/liveTv/ProgramDetails.brs @@ -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 diff --git a/components/liveTv/ProgramDetails.xml b/components/liveTv/ProgramDetails.xml index 54b198e9..47bef56e 100644 --- a/components/liveTv/ProgramDetails.xml +++ b/components/liveTv/ProgramDetails.xml @@ -2,11 +2,12 @@ - - - - - + + + + + + @@ -43,12 +44,18 @@ + + + + diff --git a/components/liveTv/schedule.brs b/components/liveTv/schedule.brs index 5af5c8e2..0c780e21 100644 --- a/components/liveTv/schedule.brs +++ b/components/liveTv/schedule.brs @@ -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