Skip to content

Commit 43ff743

Browse files
committed
Update code docs
1 parent d1cdc60 commit 43ff743

3 files changed

Lines changed: 29 additions & 117 deletions

File tree

docs/components_liveTv_ProgramDetails.bs.html

Lines changed: 27 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,16 @@
2727
m.image = m.top.findNode("image")
2828
m.favorite = m.top.findNode("favorite")
2929

30-
m.viewChannelFocusAnimationOpacity = m.top.findNode("viewChannelFocusAnimationOpacity")
31-
m.recordFocusAnimationOpacity = m.top.findNode("recordFocusAnimationOpacity")
32-
m.recordSeriesFocusAnimationOpacity = m.top.findNode("recordSeriesFocusAnimationOpacity")
30+
m.buttonsFocusAnimationOpacity = m.top.findNode("buttonsFocusAnimationOpacity")
3331
m.focusAnimation = m.top.findNode("focusAnimation")
3432

33+
m.buttons = m.top.findNode("buttons")
3534
m.viewChannelButton = m.top.findNode("viewChannelButton")
3635
m.recordButton = m.top.findNode("recordButton")
3736
m.recordSeriesButton = m.top.findNode("recordSeriesButton")
3837

39-
m.viewChannelOutline = m.top.findNode("viewChannelOutline")
40-
m.recordOutline = m.top.findNode("recordOutline")
41-
m.recordSeriesOutline = m.top.findNode("recordSeriesOutline")
42-
43-
m.viewChannelLabel = m.top.findNode("viewChannelButtonLabel")
44-
m.recordLabel = m.top.findNode("recordButtonLabel")
45-
m.recordSeriesLabel = m.top.findNode("recordSeriesButtonLabel")
46-
47-
m.viewChannelButtonBackground = m.top.findNode("viewChannelButtonBackground")
48-
m.recordButtonBackground = m.top.findNode("recordButtonBackground")
49-
m.recordSeriesButtonBackground = m.top.findNode("recordSeriesButtonBackground")
50-
5138
m.focusAnimation.observeField("state", "onAnimationComplete")
39+
m.buttons.observeField("buttonSelected", "onButtonSelected")
5240

5341
setupLabels()
5442
end sub
@@ -69,54 +57,17 @@
6957
isRepeatBackground.height = boundingRect.height + 8
7058
m.episodeDetailsGroup.removeChildIndex(0)
7159

72-
m.viewChannelLabel.text = tr("View Channel")
73-
boundingRect = m.viewChannelButton.boundingRect()
74-
viewButtonBackground = m.top.findNode("viewChannelButtonBackground")
75-
viewButtonBackground.width = boundingRect.width + 20
76-
viewButtonBackground.height = boundingRect.height + 20
77-
m.viewChannelOutline.width = viewButtonBackground.width
78-
m.viewChannelOutline.height = viewButtonBackground.height
79-
80-
m.recordLabel.text = tr("Record")
81-
boundingRect = m.recordButton.boundingRect()
82-
recordButtonBackground = m.top.findNode("recordButtonBackground")
83-
recordButtonBackground.width = boundingRect.width + 20
84-
recordButtonBackground.height = boundingRect.height + 20
85-
m.recordOutline.width = recordButtonBackground.width
86-
m.recordOutline.height = recordButtonBackground.height
87-
88-
m.recordSeriesLabel.text = tr("Record Series")
89-
boundingRect = m.recordSeriesButton.boundingRect()
90-
recordSeriesButtonBackground = m.top.findNode("recordSeriesButtonBackground")
91-
recordSeriesButtonBackground.width = boundingRect.width + 20
92-
recordSeriesButtonBackground.height = boundingRect.height + 20
93-
m.recordSeriesOutline.width = recordSeriesButtonBackground.width
94-
m.recordSeriesOutline.height = recordSeriesButtonBackground.height
95-
60+
' Handle user recording permissions
9661
m.userCanRecord = m.global.user.policy.enableLiveTvManagement
9762
if m.userCanRecord = false
98-
m.recordButton.visible = false
99-
m.recordSeriesButton.visible = false
63+
m.recordButton.enabled = false
64+
m.recordSeriesButton.enabled = false
10065
end if
10166
end sub
10267

10368
sub updateLabels(recordText = tr("Record"), recordSeriesText = tr("Record Series"))
104-
m.recordLabel.text = recordText
105-
m.recordSeriesLabel.text = recordSeriesText
106-
107-
boundingRect = m.recordButton.boundingRect()
108-
recordButtonBackground = m.top.findNode("recordButtonBackground")
109-
recordButtonBackground.width = boundingRect.width
110-
recordButtonBackground.height = boundingRect.height
111-
m.recordOutline.width = recordButtonBackground.width
112-
m.recordOutline.height = recordButtonBackground.height
113-
114-
boundingRect = m.recordSeriesButton.boundingRect()
115-
recordSeriesButtonBackground = m.top.findNode("recordSeriesButtonBackground")
116-
recordSeriesButtonBackground.width = boundingRect.width
117-
recordSeriesButtonBackground.height = boundingRect.height
118-
m.recordSeriesOutline.width = recordSeriesButtonBackground.width
119-
m.recordSeriesOutline.height = recordSeriesButtonBackground.height
69+
m.recordButton.text = recordText
70+
m.recordSeriesButton.text = recordSeriesText
12071
end sub
12172

12273
sub channelUpdated()
@@ -222,11 +173,14 @@
222173
updateLabels()
223174
end if
224175

225-
' If not a series, hide Record Series button
176+
' If not a series, hide Record Series button (doesn't make sense for non-series content)
226177
if prog.json.isSeries <> true ' could be invalid or false
227178
m.recordSeriesButton.visible = false
179+
m.recordSeriesButton.enabled = false
228180
else
229181
m.recordSeriesButton.visible = true
182+
' Restore enabled state based on user permissions (set in setupLabels)
183+
m.recordSeriesButton.enabled = m.userCanRecord
230184
end if
231185

232186
m.detailsView.visible = "true"
@@ -294,27 +248,17 @@
294248
end function
295249

296250
'
297-
' Show view channel button when item has Focus
251+
' Show button group when item has Focus
298252
sub focusChanged()
299253
if m.top.hasFocus = true
300254
m.overview.maxLines = m.maxDetailLines
301-
m.viewChannelFocusAnimationOpacity.keyValue = [0, 1]
302-
m.recordFocusAnimationOpacity.keyValue = [0, 1]
303-
m.recordSeriesFocusAnimationOpacity.keyValue = [0, 1]
304-
m.viewChannelButton.setFocus(true)
305-
m.viewChannelOutline.visible = true
306-
m.recordOutline.visible = false
307-
m.recordSeriesOutline.visible = false
308-
m.viewChannelButtonBackground.blendColor = "#006fab"
309-
m.recordButtonBackground.blendColor = "#000000"
310-
m.recordSeriesButtonBackground.blendColor = "#000000"
255+
m.buttonsFocusAnimationOpacity.keyValue = [0, 1]
256+
m.buttons.callFunc("focus") ' JRButtonGroup handles button focus
311257
else
312258
m.top.watchSelectedChannel = false
313259
m.top.recordSelectedChannel = false
314260
m.top.recordSeriesSelectedChannel = false
315-
m.viewChannelFocusAnimationOpacity.keyValue = [1, 0]
316-
m.recordFocusAnimationOpacity.keyValue = [1, 0]
317-
m.recordSeriesFocusAnimationOpacity.keyValue = [1, 0]
261+
m.buttonsFocusAnimationOpacity.keyValue = [1, 0]
318262
end if
319263

320264
m.focusAnimation.control = "start"
@@ -327,56 +271,24 @@
327271
end if
328272
end sub
329273

330-
function onKeyEvent(key as string, press as boolean) as boolean
331-
if not press then return false
274+
' Handle button selection from JRButtonGroup
275+
sub onButtonSelected()
276+
selectedIndex = m.buttons.buttonSelected
332277

333-
if key = "OK" and m.viewChannelButton.hasFocus()
278+
' Button indices: 0 = viewChannel, 1 = record, 2 = recordSeries
279+
if selectedIndex = 0
334280
m.top.watchSelectedChannel = true
335-
return true
336-
else if key = "OK" and m.recordButton.hasFocus()
281+
else if selectedIndex = 1
337282
m.top.recordSelectedChannel = true
338-
return true
339-
else if key = "OK" and m.recordSeriesButton.hasFocus()
283+
else if selectedIndex = 2
340284
m.top.recordSeriesSelectedChannel = true
341-
return true
342285
end if
286+
end sub
343287

344-
if m.userCanRecord = true
345-
if key = "right" and m.viewChannelButton.hasFocus()
346-
m.recordButton.setFocus(true)
347-
m.viewChannelOutline.visible = false
348-
m.recordOutline.visible = true
349-
m.viewChannelButtonBackground.blendColor = "#000000"
350-
m.recordButtonBackground.blendColor = "#006fab"
351-
m.recordSeriesButtonBackground.blendColor = "#000000"
352-
return true
353-
else if key = "right" and m.recordButton.hasFocus()
354-
m.recordSeriesButton.setFocus(true)
355-
m.recordOutline.visible = false
356-
m.recordSeriesOutline.visible = true
357-
m.viewChannelButtonBackground.blendColor = "#000000"
358-
m.recordButtonBackground.blendColor = "#000000"
359-
m.recordSeriesButtonBackground.blendColor = "#006fab"
360-
return true
361-
else if key = "left" and m.recordSeriesButton.hasFocus()
362-
m.recordButton.setFocus(true)
363-
m.recordOutline.visible = true
364-
m.recordSeriesOutline.visible = false
365-
m.viewChannelButtonBackground.blendColor = "#000000"
366-
m.recordButtonBackground.blendColor = "#006fab"
367-
m.recordSeriesButtonBackground.blendColor = "#000000"
368-
return true
369-
else if key = "left" and m.recordButton.hasFocus()
370-
m.viewChannelButton.setFocus(true)
371-
m.viewChannelOutline.visible = true
372-
m.recordOutline.visible = false
373-
m.viewChannelButtonBackground.blendColor = "#006fab"
374-
m.recordButtonBackground.blendColor = "#000000"
375-
m.recordSeriesButtonBackground.blendColor = "#000000"
376-
return true
377-
end if
378-
end if
288+
function onKeyEvent(key as string, press as boolean) as boolean
289+
if not press then return false
379290

291+
' Just prevent up/down from bubbling
380292
if key = "up" or key = "down"
381293
return true
382294
end if

docs/data/search.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/module-ProgramDetails.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)