Skip to content

Commit 3d2b1df

Browse files
committed
Disallow moving up from 1st channel if schedule not fully loaded
1 parent c452fe9 commit 3d2b1df

File tree

4 files changed

+43
-9
lines changed

4 files changed

+43
-9
lines changed

components/liveTv/TVSchedule.bs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import "pkg:/source/enums/KeyCode.bs"
2+
import "pkg:/source/utils/misc.bs"
3+
4+
sub init()
5+
end sub
6+
7+
function onKeyEvent(key as string, press as boolean) as boolean
8+
if not press then return false
9+
10+
' If we are on the 1st channel and the schedule isn't fully loaded yet, disallow moving up before index 0
11+
if isStringEqual(key, KeyCode.UP)
12+
if m.top.channelFocused = 0
13+
if not m.top.isLoaded then return true
14+
end if
15+
end if
16+
17+
return false
18+
end function

components/liveTv/TVSchedule.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<component name="TVSchedule" extends="TimeGrid">
3+
<interface>
4+
<field id="isLoaded" type="boolean" />
5+
</interface>
6+
</component>

components/liveTv/schedule.bs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import "pkg:/source/enums/ColorPalette.bs"
2+
import "pkg:/source/enums/KeyCode.bs"
23
import "pkg:/source/enums/TaskControl.bs"
34
import "pkg:/source/utils/misc.bs"
45

@@ -11,6 +12,8 @@ sub init()
1112
m.scheduleGrid = m.top.findNode("scheduleGrid")
1213
m.detailsPane = m.top.findNode("detailsPane")
1314

15+
m.scheduleGrid.isLoaded = false
16+
1417
m.gridData = createObject("roSGNode", "ContentNode")
1518
m.scheduleGrid.content = m.gridData
1619

@@ -69,6 +72,7 @@ sub channelFilterSet()
6972
m.LoadChannelsTask.filter = m.top.filter
7073
m.gridData.removeChildren(m.gridData.getChildren(-1, 0))
7174
m.loadedChannelCount = 0
75+
m.scheduleGrid.isLoaded = false
7276
loadChannels(m.channelFirstLoadLimit)
7377
end if
7478

@@ -91,6 +95,7 @@ sub channelsearchTermSet()
9195
startLoadingSpinner()
9296
m.gridData.removeChildren(m.gridData.getChildren(-1, 0))
9397
m.loadedChannelCount = 0
98+
m.scheduleGrid.isLoaded = false
9499
loadChannels(m.channelFirstLoadLimit)
95100
end sub
96101

@@ -116,6 +121,7 @@ sub onChannelsLoaded()
116121
m.top.signalBeacon("EPGLaunchComplete") ' Required Roku Performance monitoring
117122
m.EPGLaunchCompleteSignaled = true
118123
end if
124+
119125
m.LoadChannelsTask.channels = []
120126
end sub
121127

@@ -159,6 +165,8 @@ sub onScheduleLoaded()
159165
m.loadedChannelCount += m.LoadChannelsTask.limit
160166
if m.LoadChannelsTask.totalRecordCount > m.loadedChannelCount
161167
loadChannels(m.channelLaterLoadLimit)
168+
else
169+
m.scheduleGrid.isLoaded = true
162170
end if
163171
end sub
164172

@@ -328,14 +336,16 @@ function onKeyEvent(key as string, press as boolean) as boolean
328336
detailsGrp = m.top.findNode("detailsPane")
329337
gridGrp = m.top.findNode("scheduleGrid")
330338

331-
if key = "back" and detailsGrp.isInFocusChain()
332-
focusProgramDetails(false)
333-
detailsGrp.setFocus(false)
334-
gridGrp.setFocus(true)
335-
group = m.global.sceneManager.callFunc("getActiveScene")
336-
group.lastFocus = gridGrp
337-
return true
338-
else if key = "back"
339+
if isStringEqual(key, KeyCode.BACK)
340+
if detailsGrp.isInFocusChain()
341+
focusProgramDetails(false)
342+
detailsGrp.setFocus(false)
343+
gridGrp.setFocus(true)
344+
group = m.global.sceneManager.callFunc("getActiveScene")
345+
group.lastFocus = gridGrp
346+
return true
347+
end if
348+
339349
m.state = TaskControl.STOP
340350

341351
m.LoadChannelsTask.control = TaskControl.STOP

components/liveTv/schedule.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<!-- Selected Item Details -->
77
<ProgramDetails id="detailsPane" focusable="true" />
88

9-
<TimeGrid
9+
<TVSchedule
1010
id="scheduleGrid"
1111
channelInfoComponentName="ChannelInfo"
1212
translation="[0,600]"

0 commit comments

Comments
 (0)